I have a question about the calculation of the individual specific intercepts in a multilevel model using brms. I make a multilevel model using a panel dataset using the following command:
result_brms = brm(Activations ~ avg_CATALOGUE_PRICE + (1 | ID), data = aggregated_data, chains = 4, iter = 10000, warmup = 5000, save_model = "test_code_stan.txt", cores = getOption("mc.cores", 4L))
,
so in my model I only have a individual-specific intercept. To get these intercepts I use the command
ind_specific_coefficient = coef(result_brms)
and
ind_specific_coefficient = as.data.frame(ind_specific_coefficient$ID)
.
I also tried do construct these individual-specific-intercepts, \alpha_i, by myself using the stan file in the stan
function generated by the brm
function. To get the same estimates as with brm
I just take the mean of the individual specific draws r_1_1[i]
and add the mean of the b_intercept
. However, if the individual intercepts are determined by:
\alpha = \mu + u, where u \sim N(0,\sigma)
I would expect that I can construct the \alpha_i's by drawing from a normal distribution with mean equal to mean(temp_intercept)
(which equals the \mu I think) and standard deviation sd(r_1_1[i])
(which equals \sigma). However, in this case I get different \alpha_i's than from the brm function, but I do not get why this is wrong. Could someone explain this to me? Also, when I make a histogram of the intercepts from the brm function they look heavily censored while this is not the case in my approach. Any help is greatly appreciated.