Skip to contents

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.

Sensitivity based on cjs_dist
Prior selection: all priors
Likelihood selection: all data

    variable prior likelihood                           diagnosis
 b_Intercept 0.465      0.705 potential prior-likelihood conflict
       sigma 0.499      0.855 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.009      0.705         -
       sigma 0.015      0.855         -
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.472      0.705 potential prior-likelihood conflict
       sigma 0.513      0.855 potential prior-likelihood conflict