Extracting covariance of level-2 residuals from lme4 output

人盡茶涼 提交于 2019-12-24 08:14:06

问题


I need to know how to extract the level-2 residual covariance from a random-slopes lmer object.

library(lme4)
fm1 <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy)
summary(fm1)

This is the random effects table

Random effects:
 Groups   Name        Variance Std.Dev. Corr
 Subject  (Intercept) 612.09   24.740       
          Days         35.07    5.922   0.07
 Residual             654.94   25.592       
Number of obs: 180, groups:  Subject, 18

I know that the value 0.07 under the Corr is the covariance correlation coefficient and I can use this to calculate the actual level-2 covariance. However I am not 100% sure that what I am extracting is right. I tried

as.data.frame(VarCorr(model))

and got

       grp        var1 var2       vcov       sdcor
1  Subject (Intercept) <NA> 612.089751 24.74044768
2  Subject        Days <NA>  35.071662  5.92213326
3  Subject (Intercept) Days   9.604335  0.06555134
4 Residual        <NA> <NA> 654.941040 25.59181589

Is the value in the 3rd row in the sdcor column what I'm looking for, the covariance correlation coefficient? It seems obvious (0.065 rounded up to 0.07) but I want to make certain.

And what is the value in the 3rd row under vcov? That doesn't appear in the summary output anywhere.

来源:https://stackoverflow.com/questions/41476408/extracting-covariance-of-level-2-residuals-from-lme4-output

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!