Re: [R] ANOVA and confidence intervals plot

From: Richard M. Heiberger <rmh_at_temple.edu>
Date: Mon 02 Apr 2007 - 02:40:01 GMT


> I would like to obtain for each factor of my anova model the
> "response variable vs factor" plot with means and 95% Tukey HSD
> intervals.

I believe you are asking for the multiple comparisons plots from the multcomp package. The example below is an extension of one of the examples in ?glht:

library(multcomp)

      ### multiple comparison procedures
       ### set up a one-way ANOVA
       amod <- aov(breaks ~ tension, data = warpbreaks)

       ### set up all-pair comparisons for factor `tension'
       ### using a symbolic description (`type' argument 
       ### to `contrMat()')

warp.mca <- glht(amod, linfct = mcp(tension = "Tukey"))

confint(warp.mca)
plot(warp.mca)

You asked about the level means themselves, rather than the pairwise comparisons above. That is done with

warp.pairwise <- glht(amod, linfct = mcp(tension = "Means")) confint(warp.pairwise)
plot(warp.pairwise)

I recommend the MMC (Mean-mean Multiple Comparison) plot that includes both sets of information, pairwise comparisons and individual means, and also allows arbitrary contrasts.

library(HH)
warp.mmc <- glht.mmc(amod, linfct = mcp(tension = "Tukey")) warp.mmc
plot(warp.mmc)

See the help files
?glht
?mmc
for more details. Both glht and glht.mmc extend to multi-way designs.



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Mon Apr 02 12:45:10 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Mon 02 Apr 2007 - 16:30:35 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.