1

我无法弄清楚我为混合方差分析运行的 R 代码有什么问题。令人沮丧的是,我在不同的计算机(一台是 Mac,另一台是 PC)上的 aov 函数得到了不同的结果。此外,我在 Mac 上使用 aov 函数得到的结果与我在同一台计算机上使用 ezANOVA 得到的结果大不相同。我在 SPSS 中运行了相同的分析,并得到了与 ezANOVA 相同的结果,所以我的 aov 线似乎有问题。然而,正如我之前所说,我在我的电脑上使用相同的代码和数据文件得到了不同的结果。我很偏执,这个问题真的很简单,但我想不通,它妨碍了我完成分析。

我可能做了什么弄乱了我的默认设置?我什至重新启动计算机,我仍然得到相同的结果。

> ex.data <- structure(list(RT = c(459.15, 506.75, 382.05, 395.75, 422.263157894737, 
                             374, 433.75, 401.85, 573.8, 473.15, 335.35, 405.842105263158, 
                             390.05, 354.35, 369.7, 650.421052631579, 400.8, 426.8, 477.6, 
                             517.05, 451.3, 405.9, 380.15, 346, 595.8, 336, 451.5, 440.55, 
                             718.3, 439.55, 423.05, 560, 669.333333333333, 525.578947368421, 
                             358.75, 505.8, 426, 417.4, 361.65, 409.85, 486.631578947368, 
                             540, 438, 357.2, 401.35, 407.45, 397.166666666667, 406.052631578947, 
                             445.85, 467.6, 353.35, 366.3, 431.6, 326.6, 433.105263157895, 
                             347.75, 512.105263157895, 443.85, 296.85, 408.058823529412, 364.3, 
                             315.9, 341.5, 646.058823529412, 373.5, 414.45, 475.45, 489.45, 
                             429.368421052632, 419.35, 370.2, 327.75, 569.85, 347, 415.35, 
                             429.5, 738.15, 406.4, 400.3, 522.941176470588, 631.555555555556, 
                             484.9, 355.684210526316, 465.9, 415.5, 445.631578947368, 400.555555555556, 
                             387.4, 477.3, 503.95, 404, 394.5, 385.65, 383.55, 439.65, 371.421052631579),
                             TrialType = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
                             1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
                             1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
                             1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
                             2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
                             2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
                             2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("dtprb.con.neg", "dtprb.incon.neg"
                             ), class = "factor"), subject = c(2L, 3L, 5L, 6L, 7L, 9L, 10L, 
                             11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 100L, 101L, 102L, 103L, 
                             106L, 107L, 108L, 109L, 110L, 111L, 112L, 113L, 114L, 116L, 118L, 
                             119L, 120L, 121L, 122L, 123L, 124L, 125L, 126L, 127L, 128L, 200L, 
                             201L, 204L, 206L, 210L, 211L, 400L, 401L, 2L, 3L, 5L, 6L, 7L, 
                             9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 100L, 101L, 
                             102L, 103L, 106L, 107L, 108L, 109L, 110L, 111L, 112L, 113L, 114L, 
                             116L, 118L, 119L, 120L, 121L, 122L, 123L, 124L, 125L, 126L, 127L, 
                             128L, 200L, 201L, 204L, 206L, 210L, 211L, 400L, 401L), condition = c("placebo", 
                             "drug", "placebo", "drug", "placebo", "drug", "placebo", "drug", 
                             "drug", "placebo", "drug", "drug", "placebo", "placebo", "drug", 
                             "placebo", "placebo", "drug", "drug", "placebo", "drug", "placebo", 
                             "drug", "drug", "drug", "placebo", "placebo", "drug", "placebo", 
                             "drug", "drug", "drug", "placebo", "placebo", "placebo", "drug", 
                             "drug", "placebo", "placebo", "drug", "placebo", "placebo", "placebo", 
                             "placebo", "drug", "drug", "drug", "placebo", "placebo", "drug", 
                             "placebo", "drug", "placebo", "drug", "placebo", "drug", "drug", 
                             "placebo", "drug", "drug", "placebo", "placebo", "drug", "placebo", 
                             "placebo", "drug", "drug", "placebo", "drug", "placebo", "drug", 
                             "drug", "drug", "placebo", "placebo", "drug", "placebo", "drug", 
                             "drug", "drug", "placebo", "placebo", "placebo", "drug", "drug", 
                             "placebo", "placebo", "drug", "placebo", "placebo", "placebo", 
                             "placebo", "drug", "drug", "drug", "placebo")), .Names = c("RT", 
                             "TrialType", "subject", "condition"), row.names = c(NA, -96L), class = "data.frame")


> anova_ex.data <- aov(RT ~ TrialType*condition + Error(subject/TrialType) + condition, data=ex.data)
> summary(anova_ex.data)

Error: subject
      Df Sum Sq Mean Sq
condition  1   3267    3267

Error: subject:TrialType
      Df Sum Sq Mean Sq
TrialType  1   1738    1738

Error: Within
                Df Sum Sq Mean Sq F value Pr(>F)
TrialType            1   6747    6747   0.883  0.350
condition            1  16743   16743   2.191  0.142
TrialType:condition  1    763     763   0.100  0.753
Residuals           90 687713    7641

> ezANOVA(data = ex.data, dv = .(RT), wid = .(subject), within = .(TrialType), between = .(condition), detailed = TRUE, type = 3)

Warning: Converting "subject" to factor for ANOVA.
Warning: Converting "condition" to factor for ANOVA.
$ANOVA
           Effect DFn DFd          SSn       SSd          F            p p<.05         ges
1         (Intercept)   1  46 8620839.9719 678628.80 584.352798 8.648708e-28     * 0.925761817
2           condition   1  46   17592.2597 678628.80   1.192469 2.805185e-01       0.024815931
3           TrialType   1  46    6552.8332  12688.87  23.755499 1.340138e-05     * 0.009389755
4 condition:TrialType   1  46     887.0503  12688.87   3.215757 7.950840e-02       0.001281485

任何帮助是极大的赞赏!

4

1 回答 1

2

您的问题就在警告中。ezANOVA正在将您的预测变量转换为因子,而aov(从自由度)显然不是。当您修复它时,您至少会发现交互是相同的。

但是,一旦您正确地进行分析,您仍然会发现差异,这可能是由于单元大小不相等。这是因为在执行I 类分析或顺序分析ezANOVA时正在执行 III 类分析(SPSS 中的默认值) 。aov你需要决定你需要哪些。

很难对 Mac 到 PC 的问题发表评论,因为结果没有发布,但我打赌在跨平台翻译的某个地方,你修复了 Mac 平台中的因素问题。

于 2013-12-19T21:34:24.333 回答