The function VarCorrCI
takes a merMod
object and returns variance components and 95% confidence intervals.
Modified from: http://rpubs.com/bbolker/varwald and various other places.
library(lme4)
# Fit model
fit = lmer(Reaction ~ Days + (Days | Subject), sleepstudy)
# Using ML
VarCorrCI(fit)
# Using REML
VarCorrCI(fit, REML = T)