Understanding brms random intercept output

I have troubles understanding the brms estimate for a random factor (which I assume is the (mean?) standard deviation for all the groups, sd(Intercept)), and the estimate for each group given by mod$fit.
I have a non-linear mixed model that estimated true prevalence (Tp) from apparent prevalence (Ap). My model:

mod <- brm(
    bf(Ap~ Tp * Se + (1 - Tp) * (1 - Sp),
                 Tp ~ 1 + (1|site),
                 Se + Sp ~ 1,
                 nl = T),
   family = bernoulli(link = 'identity'), data, chains = 4)

priors <- c(set_prior('beta(2,2)', class = 'b', nlpar = 'Tp', ub = 1, lb = 0), #get_prior() tells me that intercept is also of class 'b'
              set_prior('beta(2,10)', class = 'sd', nlpar = 'Tp', ub = 1, lb = 0),
              set_prior('beta(10,1)', class = 'b', nlpar = 'Se', ub = 1, lb = 0),
              set_prior('beta(15,1)', class = 'b',  nlpar = 'Sp', ub = 1, lb = 0))

and now mod$fit:

Inference for Stan model: anon_model.
4 chains, each with iter=2000; warmup=1000; thin=1; 
post-warmup draws per chain=1000, total post-warmup draws=4000.

                                 mean se_mean   sd    2.5%     25%
b_Tp_Intercept                   0.40    0.00 0.09    0.19    0.34
b_Se_Intercept                   0.89    0.00 0.09    0.66    0.85
b_Sp_Intercept                   0.94    0.00 0.06    0.79    0.91
sd_site__Tp_Intercept            0.18    0.00 0.06    0.06    0.14
r_site__Tp[Goe1392,Intercept]   -0.17    0.00 0.14   -0.44   -0.26
r_site__Tp[Goe1425,Intercept]    0.07    0.00 0.13   -0.18   -0.01
r_site__Tp[Goe235,Intercept]    -0.16    0.01 0.14   -0.44   -0.25
r_site__Tp[Goe288,Intercept]     0.12    0.00 0.14   -0.12    0.02
r_site__Tp[Goe47,Intercept]     -0.17    0.00 0.14   -0.44   -0.26
...

in mod$fit (e.g., r_site_Tp[Goe1392], Intercept) the estimates are mostly 0.1 or -0.1. Negative numbers are not possible as specified by my priors bounds and beta families.
Regarding the model itself, I get hundreds of divergent transitions, but the effective sample sizes, the Rhat and the estimates are correct (very similar to no random effect model). What are the r_site values exactly and why are they negative?

Howdy! The r_site_Tp values are the varying intercepts, which are actually varying offsets from the Intercept in the Tp ~ 1 + (1|site) formula. What you have specified is for Tp to have an Intercept and then varying offsets from this intercept, that are modeled as coming from a normal distribution with mean of zero and sd of sd_site__Tp_Intercept. That is why you have both negative and positive values for the actual offsets r_site_Tp. As stated in the vignette, “we should think of non-linear parameters as placeholders for linear predictor terms rather than as parameters themselves.”

3 Likes

Thanks @jd_c! All clear now.

1 Like