我正在用R执行RM双向ANOVA,使用aov()函数,这给了我一个非常好的数据集结果(我用另一个统计软件得到了相同的结果),但我无法理解为什么用一个类似的数据集我输错了。
这是我的数据集&代码
t <- structure(list(Light = c(10, 10, 10, 10, 10, 100, 100, 100, 100, 100, 10, 10, 10, 10, 10, 100, 100, 100, 100, 100, 10, 10, 10, 10, 10, 100, 100, 100, 100, 100, 10, 10, 10, 10, 10, 100, 100, 100, 100, 100, 10, 10, 10, 10, 10, 100, 100, 100, 100, 100, 10, 10, 10, 10, 10, 100, 100, 100, 100, 100, 10, 10, 10, 10, 10, 100, 100, 100, 100, 100, 10, 10, 10, 10, 10, 100, 100, 100, 100, 100, 10, 10, 10, 10, 10, 100, 100, 100, 100, 100, 10, 10, 10, 10, 10, 100, 100, 100, 100, 100, 10, 10, 10, 10, 10, 100, 100, 100, 100, 100, 10, 10, 10, 10, 10, 100, 100, 100, 100, 100, 10, 10, 10, 10, 10, 100, 100, 100, 100, 100, 10, 10, 10, 10, 10, 100, 100, 100, 100, 100),
Culture = c("mono", "mono", "mono", "mono", "mono", "mono", "mono", "mono", "mono", "mono", "co", "co", "co", "co", "co", "co", "co", "co", "co", "co", "mono", "mono", "mono", "mono", "mono", "mono", "mono", "mono", "mono", "mono", "co", "co", "co", "co", "co", "co", "co", "co", "co", "co", "mono", "mono", "mono", "mono", "mono", "mono", "mono", "mono", "mono", "mono", "co", "co", "co", "co", "co", "co", "co", "co", "co", "co", "mono", "mono", "mono", "mono", "mono", "mono", "mono", "mono", "mono", "mono", "co", "co", "co", "co", "co", "co", "co", "co", "co", "co", "mono", "mono", "mono", "mono", "mono", "mono", "mono", "mono", "mono", "mono", "co", "co", "co", "co", "co", "co", "co", "co", "co", "co", "mono", "mono", "mono", "mono", "mono", "mono", "mono", "mono", "mono", "mono", "co", "co", "co", "co", "co", "co", "co", "co", "co", "co", "mono", "mono", "mono", "mono", "mono", "mono", "mono", "mono", "mono", "mono", "co", "co", "co", "co", "co", "co", "co", "co", "co", "co"),
Time = c(-4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15),
PAM = c(0.732,0.7425,0.763,0.715,0.701,0.741,0.7265,0.752,0.717,0.724,0.758,0.724,0.747, 0.755,0.789, 0.655,0.779,0.695,0.719,0.758,0.695,0.7105,0.681,0.742,0.759,0.7275,0.75,0.679,0.706,0.704,0.715,0.67,0.74,0.697,0.763,0.749,0.756,0.692,0.684,0.711,0.734,0.7315,0.7065,0.7115,0.696,0.649,0.6675,0.686,0.6745,0.649,0.757,0.688,0.725,0.688,0.736,0.704,0.688,0.722,0.659,0.627,0.7265,0.712,0.734,0.743,0.718,0.702,0.674,0.709,0.7,0.687,0.744,0.705,0.751,0.733,0.753,0.729,0.716,0.713,0.643,0.71,0.7235,0.677,0.711,0.718,0.7045,0.6625,0.6195,0.625, 0.634, 0.614,0.715, 0.66,0.707,0.704,0.652,0.631,0.639,0.629,0.655,0.637,0.737,0.733, 0.7365,0.7145,0.7105,0.674, 0.679,0.6975,0.685,0.6815,0.746,0.667,0.753,0.711,0.737,0.705,0.693, 0.697,0.65, 0.618,0.7655,0.725,0.7395,0.7065,0.7255,0.5815, 0.645, 0.6385,0.601,0.4795, 0.69,0.703, 0.727, 0.702,0.662,0.679,0.678,0.636, 0.649,0.527),
Subject = c("DM1", "DM2", "DM3", "DM4", "DM5", "DM6", "DM7", "DM8", "DM9", "DM10", "DM11", "DM12", "DM13", "DM14", "DM15", "DM16", "DM17", "DM18", "DM19", "DM20", "DM1", "DM2", "DM3", "DM4", "DM5", "DM6", "DM7", "DM8", "DM9", "DM10", "DM11", "DM12", "DM13", "DM14", "DM15", "DM16", "DM17", "DM18", "DM19", "DM20", "DM1", "DM2", "DM3", "DM4", "DM5", "DM6", "DM7", "DM8", "DM9", "DM10", "DM11", "DM12", "DM13", "DM14", "DM15", "DM16", "DM17", "DM18", "DM19", "DM20", "DM1", "DM2", "DM3", "DM4", "DM5", "DM6", "DM7", "DM8", "DM9", "DM10", "DM11", "DM12", "DM13", "DM14", "DM15", "DM16", "DM17", "DM18", "DM19", "DM20", "DM1", "DM2", "DM3", "DM4", "DM5", "DM6", "DM7", "DM8", "DM9", "DM10", "DM11", "DM12", "DM13", "DM14", "DM15", "DM16", "DM17", "DM18", "DM19", "DM20", "DM1", "DM2", "DM3", "DM4", "DM5", "DM6", "DM7", "DM8", "DM9", "DM10", "DM11", "DM12", "DM13", "DM14", "DM15", "DM16", "DM17", "DM18", "DM19", "DM20", "DM1", "DM2", "DM3", "DM4", "DM5", "DM6", "DM7", "DM8", "DM9", "DM10", "DM11", "DM12", "DM13", "DM14", "DM15", "DM16", "DM17", "DM18", "DM19", "DM20")),
.Names = c("Light", "Culture", "Time", "PAM", "Subject"),
class = "data.frame", row.names = 1:140)
attach(t)
summary(t)
Light <- as.factor(Light)
Time <- as.factor(Time)
Culture <- as.factor(Culture)
fit <- aov(PAM ~ Time*Light*Culture + Error(Subject/(Light*Culture*Time)),
data = t, projections = FALSE, qr = TRUE, contrasts = NULL)
summary(fit)
这就是我得到的结果
Error: Subject
Df Sum Sq Mean Sq F value Pr(>F)
Light 1 0.06780 0.06780 37.412 1.49e-05 ***
Culture 1 0.00024 0.00024 0.131 0.723
Light:Culture 1 0.00113 0.00113 0.621 0.442
Residuals 16 0.02900 0.00181
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Error: Subject:Time
Df Sum Sq Mean Sq F value Pr(>F)
Time 6 0.08500 0.014166 17.596 1.20e-13 ***
Time:Light 6 0.03279 0.005465 6.788 5.08e-06 ***
Time:Culture 6 0.00135 0.000225 0.280 0.9453
Time:Light:Culture 6 0.00961 0.001602 1.990 0.0746 .
Residuals 96 0.07729 0.000805
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
有人可以告诉我哪里错了吗?
另一件事是我需要测试球形度。有人可以帮助我理解如何使用aov()吗?我发现的唯一方法是在帖子中,但使用Anova()函数。
非常感谢