R:双向重复测量ANOVA& pairwise.t.test

时间:2017-07-25 14:41:02

标签: r anova t-test posthoc pairwise

使用Field在发现统计数据时使用R(pag 561)提出的单向重复测量方法ANOVA:

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',dof是(主题数是8):

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

到目前为止很好=)

让我们模拟一个双向重复测量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自由度。有趣。

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

提前谢谢

干杯

0 个答案:

没有答案