0
$\begingroup$

Does anyone know why when I perform a lmer analysis (here using the builtin sleepstudy dataset) the estimated variance matrix of the random effects from VarCorr are so different from the variance of the estimated random effects (by applying cov to the ranef that extracts random effect) thanks

(fm1 <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy))
summary(fm1)
head(data.frame(ranef(fm1)$Subject)) # random effects
data.frame(VarCorr(fm1)) # estimated variance matrix from lmer
cov(data.frame(ranef(fm1)$Subject)) # actuall variances of random effects
matrix(data.frame(VarCorr(fm1))[c(1,3,3,2),4],nc=2) # extracts variance components in same format as cov for comparison
$\endgroup$
2
  • 1
    $\begingroup$ Is this an answer to your question?: stats.stackexchange.com/questions/69882/… $\endgroup$
    – Niek
    Commented Jun 7, 2017 at 13:43
  • $\begingroup$ thats really helpful, thanks Niek, sorry I didn't spot this before $\endgroup$ Commented Jun 9, 2017 at 8:37

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.