I recently discovered coef() in brms. Now, I think I may have discovered that I have been misinterpreting random effects for nested models.
Let’s say I have this model:
outcome ~ 1 + treat + (1 + treat|Region/District/School)
If I wanted the slope of the effect of treatment on a specific School (say School A, in District B, in Region C), then I thought I would extract the posterior samples and do:
(population level effect of treat) + (random effect of treat for Region C) + (random effect of treat for District B) + (random effect of treat for School A)
In other words, I thought all of these random effects were offsets from both the population-level effect and the Group level within which they were nested. Is that not correct??
When I call coef() it appears to simply add the population-level effect for treat to the random effect of treat for School A, without including the effects of Region or District that the School is in.
@paul.buerkner have I completely misunderstood nested random effects or coef() ?
Thanks