In multilevel models, it is possible to predict (not estimate) the random effects by Empirical Bayes after the model parameters have been estimated.
I know how to use the
ranef() command to do that. However, I am interested in understanding the procedure.
Can someone provide an explanation/example how I can derive the Empirical Bayes predictions for the random effects “manually” for the example below?
# Load R package library(lme4) # Load data data(sleepstudy) # Estimate model fit <- lmer(Reaction ~ Days + (Days | Subject), data=sleepstudy) # Get model results summary(fit) # Get random effects with conditional variances ranef(fit, condVar=TRUE)