使用回归模型(LM、LMER)重复测量方差分析 [英] repeated measure anova using regression models (LM, LMER)
问题描述
我想使用回归模型而不是方差分析"(AOV) 函数在 R 中运行重复测量方差分析.
I would like to run repeated measure anova in R using regression models instead an 'Analysis of Variance' (AOV) function.
以下是我的 3 个主题内因素的 AOV 代码示例:
Here is an example of my AOV code for 3 within-subject factors:
m.aov<-aov(measure~(task*region*actiontype) + Error(subject/(task*region*actiontype)),data)
有人能给我提供使用回归模型运行相同分析的确切语法吗?我想确保尊重残差的独立性,即像 AOV 一样使用特定的误差项.
Can someone give me the exact syntax to run the same analysis using regression models? I want to make sure to respect the independence of residuals, i.e. use specific error terms as with AOV.
在上一篇文章中,我读到了这样一个答案:
In a previous post I read an answer of the type:
lmer(DV ~ 1 + IV1*IV2*IV3 + (IV1*IV2*IV3|Subject), dataset))
我真的不确定这个解决方案,因为它仍然将变量视为主体之间的变量,而且我不明白添加随机因素会如何改变这一点.
I am really not sure about this solution since it still treats variables as between subjects, and I don't understand how adding random factors would change this.
有人知道如何在考虑残差独立性的情况下使用 lm/lmer 运行重复测量方差分析吗?
Does someone know how to run repeated measure anova with lm/lmer taking into account residual independence?
非常感谢,太阳能
推荐答案
如果你的 aov 例子是正确的(也许你不想嵌套)你想要这个:
If your aov example is right (maybe you don't want to nest things) you want this:
lmer(measure~(task*region*actiontype) + 1(1|subject/(task:region:actiontype))
如果残差独立意味着截距和斜率独立计算,则需要分别指定它们:
If residual independence means intercept and slope independently calculated you need to specify them separately:
+(1|yourfactors)+(0+variable|yourfactors)
或使用符号:
+(1||yourfactors)
无论如何,如果您阅读帮助文件,您会发现 lme4 无法处理最常见的问题.
Anyway if you read the help files you can find that lme4 can't deal with the most general problems.
这篇关于使用回归模型(LM、LMER)重复测量方差分析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!