Skip to content

TukeyHSD output

3 messages · David Douterlungne, Jinsong Zhao, David L Carlson

#
On 2012-08-24 8:58, David Douterlungne wrote:
library(multcompView)
?multcompLetters
#
Your best bet is to use package multcomp:

set.seed(42)
A <- rnorm(25, 6, 2)
B <- rnorm(25, 7, 2)
C <- rnorm(25, 7.5, 2)
D <- rnorm(25, 8, 2)
Example <- rbind(data.frame(grp="A", X=A), data.frame(grp="B", X=B), 
     data.frame(grp="C", X=C), data.frame(grp="D", X=D))

require(multcomp)
Anova.Ex <- aov(X~grp, data=Example)
summary(Anova.Ex)
# (g)eneral (l)inear (h)ypothesis (t)esting
Pairs.Ex <- glht(Anova.Ex, linfct=mcp(grp="Tukey")) 
summary(Pairs.Ex)
confint(Pairs.Ex) # Confidence intervals
cld(Pairs.Ex)     # (c)ompact (l)etter (d)isplay
plot(confint(Pairs.Ex)) 

----------------------------------------------
David L Carlson
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77843-4352