我正在尝试从使用ez
包转移到lme
重复测量方差分析(因为我希望我能够在 with 上使用自定义对比lme
)。
按照这篇博文的建议,我能够同时使用aov
(如ez
请求时一样)和lme
. 但是,虽然在那篇文章中给出的示例中, F值确实在aov
和之间完全一致lme
(我检查了它,它们确实如此),但我的数据并非如此。尽管F值相似,但它们并不相同。
aov
返回 f 值 1.3399,lme
返回 1.36264。我愿意接受aov
结果作为“正确”结果,因为这也是 SPSS 返回的结果(这对我的领域/主管很重要)。
问题:
如果有人能解释为什么存在这种差异以及我如何使用它
lme
来提供可信的结果,那就太好了。(如果它给出“正确”的结果,我也愿意使用lmer
而不是lme
这种类型的东西。但是,到目前为止我还没有使用它。)解决这个问题后,我想进行对比分析。特别是我会对合并前两个因子水平(即
c("MP", "MT")
)的对比感兴趣,并将其与第三个因子水平(即 )进行比较"AC"
。此外,测试因子的第三与第四水平(即,"AC"
与"DA"
)。
数据:
tau.base <- structure(list(id = structure(c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L,
9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L,
22L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L,
14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 1L, 2L, 3L, 4L,
5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L,
19L, 20L, 21L, 22L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L,
11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L), .Label = c("A18K",
"D21C", "F25E", "G25D", "H05M", "H07A", "H08H", "H25C", "H28E",
"H30D", "J10G", "J22J", "K20U", "M09M", "P20E", "P26G", "P28G",
"R03C", "U21S", "W08A", "W15V", "W18R"), class = "factor"), factor = structure(c(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, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L), .Label = c("MP", "MT", "AC", "DA"
), class = "factor"), value = c(0.9648092876, 0.2128662077, 1,
0.0607615485, 0.9912814024, 3.22e-08, 0.8073856412, 0.1465590332,
0.9981672618, 1, 1, 1, 0.9794401938, 0.6102546108, 0.428651501,
1, 0.1710644881, 1, 0.7639763913, 1, 0.5298989196, 1, 1, 0.7162733447,
0.7871177434, 1, 1, 1, 0.8560509327, 0.3096989662, 1, 8.51e-08,
0.3278862311, 0.0953598576, 1, 1.38e-08, 1.07e-08, 0.545290432,
0.1305621416, 2.61e-08, 1, 0.9834051136, 0.8044114935, 0.7938839461,
0.9910112678, 2.58e-08, 0.5762677121, 0.4750002288, 1e-08, 0.8584252623,
1, 1, 0.6020385797, 8.51e-08, 0.7964935271, 0.2238374288, 0.263377904,
1, 1.07e-08, 0.3160751898, 5.8e-08, 0.3460325565, 0.6842217296,
1.01e-08, 0.9438301877, 0.5578367224, 2.18e-08, 1, 0.9161424562,
0.2924856039, 1e-08, 0.8672987992, 0.9266688748, 0.8356425464,
0.9988463913, 0.2960361777, 0.0285680426, 0.0969063841, 0.6947998266,
0.0138254805, 1, 0.3494775301, 1, 2.61e-08, 1.52e-08, 0.5393467752,
1, 0.9069223275)), .Names = c("id", "factor", "value"), class = "data.frame", row.names = c(1L,
6L, 10L, 13L, 16L, 17L, 18L, 22L, 23L, 24L, 27L, 29L, 31L, 33L,
42L, 43L, 44L, 45L, 54L, 56L, 58L, 61L, 64L, 69L, 73L, 76L, 79L,
80L, 81L, 85L, 86L, 87L, 90L, 92L, 94L, 96L, 105L, 106L, 107L,
108L, 117L, 119L, 121L, 124L, 127L, 132L, 136L, 139L, 142L, 143L,
144L, 148L, 149L, 150L, 153L, 155L, 157L, 159L, 168L, 169L, 170L,
171L, 180L, 182L, 184L, 187L, 190L, 195L, 199L, 202L, 205L, 206L,
207L, 211L, 212L, 213L, 216L, 218L, 220L, 222L, 231L, 232L, 233L,
234L, 243L, 245L, 247L, 250L))
和代码:
require(nlme)
summary(aov(value ~ factor+Error(id/factor), data = tau.base))
anova(lme(value ~ factor, data = tau.base, random = ~1|id))