Cannot change prior of population-level Intercept

Hi,

I’m interested in fitting a linear mixed effects models of the form y ~ 1 + x + (1+x|id). Before running brm, I try to set the prior of the two fixed effects using:

prior1 = c(set_prior(‘normal(0,1)’,class=‘b’,coef=‘x’),
set_prior(‘normal(0,25)’,class=‘Intercept’))

However, when I look at both prior and posterior distribution of the Intercept afterwards, the prior does not capture the actual prior I specified (normal(0,25)).

plot(hypothesis(fit, “Intercept > 0”))

I am using brms version 2.4.2

R version 3.4.2 (2017-09-28)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.6

This is explained in detail in ?set_prior and ?brmsformula. In short, if you want to specify a prior on the actual intercept, you have to write y ~ 0 + Intercept + x + (1+x|id).

3 Likes

I thought I already tried the ‘0 + Intercept’ way but obviously I didn’t. Everything works fine now. Thanks for your help.