Tukey HSD with repeated measure ANOVA

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Tukey HSD with repeated measure ANOVA

Roberto
Hi,
I need to determinate HSD value from a matrix like that

Thesis Days   A1
Cx 0 66.07
Cx 0 60.24
Cx 0 42.86
Tw 0 66.07
Tw 0 60.24
Tw 0 42.86
Aa 0 66.07
Aa 0 60.24
Aa 0 42.86
Qe 0 66.07
Qe 0 60.24
Qe 0 42.86
Cx 56 310.86
Cx 56 223.17
Cx 56 186.77
Tw 56 149.42
Tw 56 127.75
Tw 56 138.59
Aa 56 130.24
Aa 56 214.83
Aa 56 137.95
Qe 56 186.64
Qe 56 189.09
Qe 56 187.87

this is my script

require(agricolae)
file <- "A1.txt"
data_table <- read.table(file, header=T, row.names=NULL)

attach(data_table)
anova <- aov(A1 ~ factor(Thesis)*factor(Days))
detach(data_table)

first of all, I need to know if my script has conceptual errors

secondly, I need to calculate HSD between Thesis:Days means
I try with Tukey.test command from agricolae package, but it do not work
I can use only these commands

Tukey.test(anova, "Thesis")
Tukey.test(anova, "Days")

but not

Tukey.test(anova, "Thesis*Days")

how can I do?

my apologies for the banal questions, but I'm taking the first steps in statistical computing

Thanks,
Roberto
Reply | Threaded
Open this post in threaded view
|

Re: Tukey HSD with repeated measure ANOVA

Daniel Malter
Try TukeyHSD(anova). TukeyHSD is implemented in the base package, i.e., ready to use with the base installation of R. Also, the TukeyHSD for the interaction term should have a colon ":" not a "*". The "which" argument in TukeyHSD() must be identical to the name of the coefficient in the summary table.
See the example below:

Thesis<-sample(c(1:3),300,replace=T)
Days<-sampe(c(1:2),300,replace=T)
Days<-sample(c(1:2),300,replace=T)
e=rnorm(300)
y<-Thesis+Days+Thesis*Days+e
my.anova<-aov(y~factor(Thesis)*factor(Days))
summary(my.anova)
TukeyHSD(my.anova)
TukeyHSD(my.anova,which="factor(Thesis)*factor(Days)") #fails
TukeyHSD(my.anova,which="factor(Thesis):factor(Days)") #works

HTH,
Daniel


Roberto wrote
Hi,
I need to determinate HSD value from a matrix like that

Thesis Days   A1
Cx 0 66.07
Cx 0 60.24
Cx 0 42.86
Tw 0 66.07
Tw 0 60.24
Tw 0 42.86
Aa 0 66.07
Aa 0 60.24
Aa 0 42.86
Qe 0 66.07
Qe 0 60.24
Qe 0 42.86
Cx 56 310.86
Cx 56 223.17
Cx 56 186.77
Tw 56 149.42
Tw 56 127.75
Tw 56 138.59
Aa 56 130.24
Aa 56 214.83
Aa 56 137.95
Qe 56 186.64
Qe 56 189.09
Qe 56 187.87

this is my script

require(agricolae)
file <- "A1.txt"
data_table <- read.table(file, header=T, row.names=NULL)

attach(data_table)
anova <- aov(A1 ~ factor(Thesis)*factor(Days))
detach(data_table)

first of all, I need to know if my script has conceptual errors

secondly, I need to calculate HSD between Thesis:Days means
I try with Tukey.test command from agricolae package, but it do not work
I can use only these commands

Tukey.test(anova, "Thesis")
Tukey.test(anova, "Days")

but not

Tukey.test(anova, "Thesis*Days")

how can I do?

my apologies for the banal questions, but I'm taking the first steps in statistical computing

Thanks,
Roberto