1

使用 Field 在 Discovering Statistics Using R (第 561 页) 中提出的示例进行单向重复测量方差分析:

Participant <- gl(8, 4, labels = c("P1", "P2", "P3", "P4", "P5", "P6", "P7","P8" ))
Animal      <- gl(4, 1, 32, labels = c("Stick_Insect", "Kangaroo_Testicle", "Fish_Eye", "Witchetty_Grub"))
Retch       <- c(8, 7, 1, 6, 9, 5, 2, 5, 6, 2, 3, 8, 5, 3, 1, 9, 8, 4, 5, 8, 7, 5, 6, 7, 10, 2, 7, 2, 12, 6, 8, 1)

longBush<-data.frame(Participant, Animal, Retch)

pairwise.t.test(longBush$Retch, longBush$Animal, paired=TRUE, alternative="two.sided", p.adjust.method="none")

结果是:

              Stick_Insect Kangaroo_Testicle Fish_Eye
Kangaroo_Testicle 0.00202      -                 -       
Fish_Eye          0.00094      0.92007           -       
Witchetty_Grub    0.22673      0.29867           0.40204 

改变一点'pairwise.t.test',自由度是(科目数是8):

              Stick_Insect Kangaroo_Testicle Fish_Eye
Kangaroo_Testicle 7            -                 -       
Fish_Eye          7            7                 -       
Witchetty_Grub    7            7                 7

到目前为止一切顺利=)

让我们模拟一个 2-way 重复测量 ANOVA:

Participant <- gl(8, 8, labels = c("P1", "P2", "P3", "P4", "P5", "P6", "P7","P8" ))
Animal      <- gl(4, 1*2, 64, labels = c("Stick_Insect", "Kangaroo_Testicle", "Fish_Eye", "Witchetty_Grub"))
Alive       <- gl(2, 1, 64, labels = c("Y", "N"))
Retch       <- sample(c(1:12), 64, replace = TRUE)

longBush2 <- data.frame(Participant, Animal, Alive, Retch)

pairwise.t.test(longBush2$Retch, longBush2$Animal, paired=TRUE, alternative="two.sided", p.adjust.method="none"); 

pairwise.t.test 结果为:

              Stick_Insect Kangaroo_Testicle Fish_Eye
Kangaroo_Testicle 0.022        -                 -       
Fish_Eye          0.202        0.584             -       
Witchetty_Grub    0.374        0.041             0.433   

和自由度:

              Stick_Insect Kangaroo_Testicle Fish_Eye
Kangaroo_Testicle 15           -                 -       
Fish_Eye          15           15                -       
Witchetty_Grub    15           15                15  

相反,因子 Alive 有 31 个自由度。有趣的。

所以,我的问题是:为什么自由度被错误地改变了?我做错了什么?

先感谢您

干杯

4

0 回答 0