1

Using the example proposed by Field in Discovering Statistics Using R (pag 561) for 1-way repeated measures 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")

The result is:

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

Change a bit 'pairwise.t.test', the dof are (the number of subjects is 8):

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

so far so good =)

Let's simulate a 2-way repeated measures 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"); 

The pairwise.t.test results are:

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

and the dof:

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

Instead, the factor Alive has 31 dof. Interesting.

So, my questions: why the dof are wrongly changed? what do I do wrong?

Thank you in advance

Cheers

Not Sure
  • 51
  • 5
  • I did a bit a mess with stackoverflow and cross validated, but does this question fit better into the latter? – Not Sure Jul 26 '17 at 08:56

0 Answers0