R ranef(model, condVar) attributes NULL, but postVar show results + deprecated warning

[亡魂溺海] 提交于 2020-01-05 04:12:29

问题


I am finding a weird behaviour in lmer (lme4 version 1.1.12) model fits trying to extract random effect attributes (conditional variances).

With the Arabidopsis dataset:

#Model maybe makes no sense and fits horribly, but that doesn't matter for my point
model <- lmer(total.fruits ~ nutrient * gen + (nutrient + gen | reg), data=Arabidopsis)

# Get conditional variances with postVar generates output + warning
attr(ranef(model, postVar=T)[[1]], "postVar")


    , , 1

       [,1]     [,2]     [,3]
[1,] 45.263 -3.37843 -1.57356
[2,] -3.378  0.70041  0.01081
[3,] -1.574  0.01081  0.08008

, , 2

      [,1]      [,2]      [,3]
[1,] 98.09 -1.519936 -4.790450
[2,] -1.52  0.314335  0.005048
[3,] -4.79  0.005048  0.250406

, , 3

        [,1]       [,2]       [,3]
[1,] 19.1829 -1.8417121 -0.5693759
[2,] -1.8417  0.4106308 -0.0009613
[3,] -0.5694 -0.0009613  0.0301338


Warning message:
In ranef.merMod(model, postVar = T) :
  ‘postVar’ is deprecated: please use ‘condVar’ instead

BUT, with condVar:

#Input
attr(ranef(model, condVar=T)[[1]], "condVar")
#Output
NULL

I discovered that while working with another dataset, where I get exactly the same behaviour (postVar works, but gives warning, condVar does nothing).

I'm now sticking with postVar and ignoring the warning, but I wanted to know if there is something I am missing with this, or it is a bug, or if I am doing something wrong? (I discovered this trying to make a qqplot with ggplot, and it wont work if I don't use postCond) Any comments would be appreciated, Thanks!


回答1:


This is admittedly confusing. The argument has changed to condVar but the attribute name is still postVar ...

attr(ranef(model, condVar=TRUE)[[1]], "postVar")


来源:https://stackoverflow.com/questions/39125896/r-ranefmodel-condvar-attributes-null-but-postvar-show-results-deprecated-w

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