The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Using priorsense with brms

library(posterior)
library(priorsense)
library(brms)

brms has built-in support for priorsense, such that it can be used directly without any modifications to model code. However, priors can also be tagged in order to selectively power-scale priors. Consider the univariate normal model with unknown mu and sigma available viaexample_powerscale_model("univariate_normal"). By also defining separate intercept and sigma prior tags, it will be possible to check the sensitivity for each prior separately.

normal_model <- example_powerscale_model(model = "univariate_normal")

priors <- c(
  prior(coef = "Intercept", normal(0, 1), tag = "intercept"),
  prior(class = "sigma", normal(0, 2.5), tag = "sigma")
)

fit <- brm(
  bf(y ~ 1, center = FALSE),
  data = data.frame(y = normal_model$data$y),
  prior = priors
)

Then the priorsense functions will work as usual.

powerscale_sensitivity(fit)
Sensitivity based on cjs_dist
Prior selection: all priors
Likelihood selection: all data

    variable prior likelihood                           diagnosis
 b_Intercept 0.355      0.485 potential prior-likelihood conflict
       sigma 0.245      0.456 potential prior-likelihood conflict
powerscale_sensitivity(fit, prior_selection = "sigma")
Sensitivity based on cjs_dist
Prior selection: sigma
Likelihood selection: all data

    variable prior likelihood diagnosis
 b_Intercept 0.003      0.485         -
       sigma 0.006      0.456         -
powerscale_sensitivity(fit, prior_selection = "intercept")
Sensitivity based on cjs_dist
Prior selection: intercept
Likelihood selection: all data

    variable prior likelihood                           diagnosis
 b_Intercept 0.358      0.485 potential prior-likelihood conflict
       sigma 0.251      0.456 potential prior-likelihood conflict
powerscale_plot_dens(fit)

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.