gpt4 book ai didi

r - LME 中使用的 varIdent 函数工作正常吗?

转载 作者:行者123 更新时间:2023-12-01 01:00:15 25 4
gpt4 key购买 nike

如果有人能帮我解决这个问题,我会很高兴。我有重复测量设计的数据,我们测试了鸟类感染前后的 react ( time.dep )( exper )。我们还有FL (燃料负荷,瘦体重百分比),脂肪评分和组(实验与对照)作为解释变量。我决定使用 LME ,因为残差分布不偏离正态。但是残差的同质性存在问题。 “之前”和“之后”组的差异以及脂肪水平之间的差异显着(Fligner-Killeen 检验,分别为 p=0.038p=0.01)。

   ring    group fat time.dep  FL   exper
1 XZ13125 E 4 0.36 16.295 before
2 XZ13125 E 3 0.32 12.547 after
3 XZ13126 E 3 0.28 7.721 before
4 XZ13127 C 3 0.32 9.157 before
5 XZ13127 C 3 0.40 -1.902 after
6 XZ13129 C 4 0.40 10.382 before

在我选择了模型的随机部分,即随机截距 ( ~1|ring ) 之后,我为“fat”和“exper”应用了权重参数 ( varComb(varIdent(form=~1|fat), varIdent(form=~1|exper))。现在标准化残差与拟合的图看起来更好,但我仍然违反了这些变量的同质性(fligner 测试中的相同值)。我做错了什么?

最佳答案

lme中的常见陷阱是默认值是给出原始残差,即未针对可能已使用的任何异方差性 ( weights ) 或相关性 ( correlation ) 子模型进行调整。来自 ?residuals.lme :

type: an optional character string specifying the type of residuals to be used. If ‘"response"’, as by default, the “raw” residuals (observed - fitted) are used; else, if ‘"pearson"’, the standardized residuals (raw residuals divided by the corresponding standard errors) are used; else, if ‘"normalized"’, the normalized residuals (standardized residuals pre-multiplied by the inverse square-root factor of the estimated error correlation matrix) are used. Partial matching of arguments is used, so only the first character needs to be provided.



因此,如果您希望针对异方差性(包含在模型中)对残差进行校正,则需要 type="pearson" ;如果您希望对它们进行相关性校正,则需要 type="normalized" .

关于r - LME 中使用的 varIdent 函数工作正常吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24106604/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com