[R] Tukey HSD with repeated measure ANOVA

Daniel Malter daniel at umd.edu
Wed Jul 13 23:03:41 CEST 2011


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
> 

--
View this message in context: http://r.789695.n4.nabble.com/Tukey-HSD-with-repeated-measure-ANOVA-tp3665872p3666090.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list