I defined a model and I want to set a prior on the non-centered intercept. One way to do so in
brms, which by default centers the intercept, is to use the formulation
y ~ 0 + Intercept + .... This works fine.
I read in the manual that the same results could be obtained by setting
bf(y ~ 1 + ..., center = FALSE). I noticed that this is true if only for the location parameter of the distribution. If we are also estimating the scale of the distribution with a similar formula, the intercept for this will be centered.
library(tidyverse) library(brms) library(tidybayes) data = read.csv('https://raw.githubusercontent.com/vincentarelbundock/Rdatasets/master/csv/lme4/sleepstudy.csv') %>% as_tibble(data) %>% mutate(Subject = factor(Subject)) bf <- bf(Reaction ~ Days + (Days | Subject), sigma ~ Days + (Days | Subject), center = FALSE) get_prior(bf, data = data)
will output (notice the
prior class coef group resp dpar nlpar bound 1 b 2 b Days 3 b Intercept 4 lkj(1) cor 5 cor Subject 6 student_t(3, 0, 59.3) sd 7 sd Subject 8 sd Days Subject 9 sd Intercept Subject 10 b sigma 11 b Days sigma 12 student_t(3, 0, 2.5) Intercept sigma 13 student_t(3, 0, 59.3) sd sigma 14 sd Subject sigma 15 sd Days Subject sigma 16 sd Intercept Subject sigma
Is this the expected behavior?
- Operating System: Win 10
- brms Version: 2.13.13