[英]Repeated Measures: From SPSS to R
I am looking to run a mixed effects model in R based on how I used to run the stats in SPSS with a repeated measures ANOVA. 我希望根据我过去在SPSS中使用重复测量方差分析运行统计数据的方式在R中运行混合效果模型。 Here is how I set up the repeated measures ANOVA in SPSS. 这是我在SPSS中设置重复测量方差分析的方法。 How would I convert this to lme4 in R? 如何在R中将其转换为lme4?
Key : EBT100... is the name of the task, Genotype is my IV, and my within-subject factors are Day (5 levels) and Cue (9 levels). 密钥 :EBT100 ...是任务的名称,基因型是我的IV,我的主题内因素是Day(5级)和Cue(9级)。 Att is my DV. Att是我的DV。
In R, this is the code that I am trying to run: In R, here is my code: 在R中,这是我要运行的代码:在R中,这是我的代码:
lmeModel <- lmer(Att ~ Genotype*Day*Cue + (1|Subject)
My Genotype Effect is the same between R and SPSS (p~0.12), but all of my interactions are different (Genotype x Day, Genotype x Cue, Genotype x Day x Cue). 我的基因型效应在R和SPSS之间是相同的(p〜0.12),但是我所有的相互作用都是不同的(基因型x天,基因型x线索,基因型x天x线索)。
R (lme4) Output: R(lme4)输出:
Sum Sq Mean Sq NumDF DenDF F.value Pr(>F)
Genotype 488 243.9 2 32 2.272 0.11954
Day 25922 6480.4 4 1408 60.356 < 2.2e-16 ***
Cue 35821 4477.6 8 1408 41.703 < 2.2e-16 ***
Genotype:Day 3646 455.7 8 1408 4.244 4.751e-05 ***
Genotype:Cue 736 46.0 16 1408 0.429 0.97560
Day:Cue 5063 158.2 32 1408 1.474 0.04352 *
Genotype:Day:Cue 3297 51.5 64 1408 0.480 0.99984
SPSS Repeated Measures ANOVA output: SPSS重复测量方差分析输出:
F.value Pr(>F)
Genotype 2.272 0.120
Day 9.603 0.000
Cue 83.916 0.000
Genotype:Day 0.675 0.712
Genotype:Cue 0.863 0.613
Day:Cue 3.168 0.00
Genotype:Day:Cue 1.031 0.411
You can see that the main effect of Genotype is the same for both R and SPSS. 您可以看到,R和SPSS的基因型主要作用相同。 Additionally, in R, my DenDF output is not correct either. 此外,在R中,我的DenDF输出也不正确。 Any idea as to why this would be? 知道为什么会这样吗?
Even more... Using ezANOVA, with the same dataset that I am using for lme4, this is my code: 甚至更多...使用ezANOVA,并使用与我用于lme4相同的数据集,这是我的代码:
anova <- ezANOVA(data = dat,
wid = Subject,
dv = Att,
within = .(Day, Cue),
between = Genotype,
type = 3)
ezANOVA Output: ezANOVA输出:
Effect DFn DFd F p p<.05 ges
2 Genotype 2 32 2.2715034 1.195449e-01 0.044348362
3 Day 4 128 9.6034152 8.003233e-07 * 0.103474748
5 Cue 8 256 83.9162989 3.938364e-67 * 0.137556761
4 Genotype:Day 8 128 0.6753544 7.124675e-01 0.015974029
6 Genotype:Cue 16 256 0.8624463 6.133218e-01 0.003267726
7 Day:Cue 32 1024 3.1679308 1.257738e-08 * 0.022046134
8 Genotype:Day:Cue 64 1024 1.0313631 4.115000e-01 0.014466102
How can I convert ezANOVA to lme4? 如何将ezANOVA转换为lme4?
Any information would be greatly appreciated! 任何信息将不胜感激! Thank you! 谢谢!
First off: It would be very beneficial and instructive if you could share your data, which allows for an easier comparison of lmer
results with those from SPSS/ ezANOVA
. 首先:如果您可以共享数据,那将是非常有益和有益的,这可以更轻松地将lmer
结果与SPSS / ezANOVA
结果进行比较。
Personally I prefer mixed effect (ie hierarchical) models as I find them easier to understand (and construct), so I am not that familiar with repeated measure ANOVA. 我个人更喜欢混合效果(即分层)模型,因为我发现它们更易于理解(和构造),所以我对重复测量方差分析并不那么熟悉。 Translating the latter into the former boils down to correctly translating within/between effects of your RM-ANOVA into the appropriate terms of your lmer
mixed-effect model. 将后者转换为前者归结为正确地将RM-ANOVA的效果内部/之间转换为lmer
混合效果模型的适当术语。
Provided I understood you correctly, the following seems consistent with your model problem statement: 只要我对您的理解正确,以下内容似乎与您的模型问题陈述相符:
Genotype
is your fixed effect Genotype
是您的固定作用 Subject
is your random (grouping or blocking) effect Subject
是您的随机(分组或阻止)效果 Day
is a within- Subject
effect Day
是批内Subject
作用 Cue
is a within- Subject
effect Cue
是批内Subject
作用 The corresponding lmer
model should look something like this: 相应的lmer
模型应如下所示:
lmer(Obs ~ Genotype * Day * Cue + (Day:Cue|Subject)
If this is not tractable, you should try 如果这很难处理,则应尝试
lmer(Obs ~ Genotype * Day * Cue + (Day|Subject) + (Cue|Subject) + (1|Subject)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.