I trying to run a simple two-level MLM with a group-mean centered (cwc - centered within cluster) level-1 variable. As my clusters have relatively small size, the observed mean would not be reliable. It would be better to estimate the unobserved true group means and work with those.
I’m wondering if there is a reasonable way to do this in brms? I’ve seen some people (mostly working with lmer) do something like this:
Ultimately, one wants to fit
fit <- lmer(MATHACH ~ SEScwc, (1|ID), data=dat)
one first does
m <- lmer(SES ~ (1|ID), data=dat)
, uses the ranef() command to extract the random effect u0js, add that to the grand intercept (and call that the ‘empirical bayes estimate’ of the group-specific intercepts), and use that to make SEScwc, which can be fed into the first model.
I could do the same with brms using the Estimate.Intercept column returned by the same ranef() command, but my concern is that this procedure does not take into account our uncertainty in each of the estimated cluster means. Is there a way to work with latent group means in brms in a more integrated way? I’ve thought of using the me() option in brms, but can’t seem to figure out how I should do it. I would appreciate any form of advice, even brief ones.
Here is (a basic form) of one of the equations that I’m actually trying to estimate - I’m trying to estimate the latent cluster mean of a binary predictor X within the model.
Priors omitted