问题描述
我在lmer(lme4版本1.1.12)模型中发现一种奇怪的行为,该模型适合尝试提取随机效应属性(条件方差).
I am finding a weird behaviour in lmer (lme4 version 1.1.12) model fits trying to extract random effect attributes (conditional variances).
使用拟南芥数据集:
#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
但带有condVar:
BUT, with condVar:
#Input
attr(ranef(model, condVar=T)[[1]], "condVar")
#Output
NULL
我发现在使用另一个数据集时,我得到的行为完全相同(postVar有效,但给出警告,condVar不执行任何操作).
I discovered that while working with another dataset, where I get exactly the same behaviour (postVar works, but gives warning, condVar does nothing).
我现在坚持使用postVar并忽略警告,但是我想知道是否缺少此功能,或者它是一个错误,还是我做错了什么? (我发现这试图用ggplot制作一个qqplot,如果我不使用postCond,它将无法正常工作)任何意见,将不胜感激,谢谢!
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!
推荐答案
这确实令人困惑. 参数已更改为condVar
,但属性名称仍为postVar
...
This is admittedly confusing. The argument has changed to condVar
but the attribute name is still postVar
...
attr(ranef(model, condVar=TRUE)[[1]], "postVar")
这篇关于R ranef(model,condVar)属性为NULL,但postVar显示结果+不建议使用的警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!