Plot(hypothesis) does not show prior

I’m trying to plot a prior and posterior next to each other. I’ve seen so many examples in which this is done using plot(hypothesis(fit, “hypothesis”)). When I do so, the posterior is being plotted but the prior is not even though I use sample_prior = TRUE when fitting my model. Could this be because I’m using default priors at the moment? Or am I doing something else wrong?

Here my syntax

Mind.Int ← brm(PMindT3 ~ 1 + (1 |p| mm(T1_ID, T2_ID, T3_ID, T4_ID, weights = cbind(W_T1, W_T2, W_T3, W_T4))) + (1 |q| mm(C1_ID, C2_ID, C3_ID, C4_ID, weights = cbind(W_C1, W_C2, W_C3, W_C4))), data=d_main, family=skew_normal(), control = list(adapt_delta = 0.99), inits = 0, sample_prior = TRUE)
pMind.Int.prior ← plot(hypothesis(Mind.Int, “Intercept > 0”))

  • Operating System: macOS Mojave
  • brms Version: 2.9.1

This is because the default prior on the parameter you want to plot is completely flat.

Is student_t(3, 3, 10) a flat prior? Because that’s the prior I get when using prior_summary. I’ve also tried this with different priors though and it never worked.

I am sorry, I should have read more closely. For technical reasons, we cannot sample from the prior of the Intercept when sample_prior = TRUE and it is actually good that we cannot because the prior applies to the temporary intercept not the actual one (see ?set_prior).

To allow sampling from the prior of the intercept as well, replace 1 by 0 + Intercept, that is, go for

brm(MindT3 ~ 0 + Intercept + ..., prior = set_prior(<your prior>, class = "b"))
1 Like

Thanks, Paul. This did the trick.