[R] Work around for TukeyHSD names
Martin Henry H. Stevens
HStevens at MUOhio.edu
Fri May 14 22:04:31 CEST 2004
R Version 2.0.0 Under development (unstable) (2004-05-07)
I have been wanting to use TukeyHSD for two and three way aov's, as
they are especially simple for students to use correctly. I realize
model simplification is usually a preferred methodology, but my
disciplinary enertia and simplicity of TukeyHSD is also compelling.
However, the lack of names on the comparisons for the higher order
interactions has frustrated us. Here I present a simple, if clumsy
work-around to provide names for both the tabluar and plot outputs.
ANY FEEDBACK would be appreciated.
My work-around example:
data(warpbreaks)
fm1 <- aov(breaks ~ wool * tension, data = warpbreaks)
a <- TukeyHSD(fm1, "wool:tension") ; a # Gives unlabeled differences
wt <- warpbreaks$tension:warpbreaks$wool # Creates interaction term
with the correct order of comparisons
b <-TukeyHSD(aov(breaks~wt,warpbreaks))) # Correctly labels differences
, but provides differences that, I think, are slightly inaccurate.
rowames(a) <- rownames(b) # Provides rownames for the correct
differences
par(mar=c(5,10,4,2)+0.1)
plot(a, las=1) # Puts correct labels on differences.
Thanks for any comments,
Hank Stevens
Dr. Martin Henry H. Stevens, Assistant Professor
338 Pearson Hall
Botany Department
Miami University
Oxford, OH 45056
Office: (513) 529-4206
Lab: (513) 529-4262
FAX: (513) 529-4243
http://www.cas.muohio.edu/botany/bot/henry.html
http://www.muohio.edu/ecology/
http://www.muohio.edu/botany/
More information about the R-help
mailing list