When one wishes to compare (test) multiple groups (as is the case, for example, when doing anova), one is confronted with the issue of multiple comparisons. The same applys if we wish to plot the comparisons.
My question is 开发者_开发知识库thus, what tools (in R) do you know of that allow plotting that reflects multiple comparisons?
Currently, I know of only two (although I am sure there are more):
- TukeyHSD( ) combined with plot( )
- The way boxplot chooses the "notches"
Package multcomp has e.g. plot.cld()
-- you could try
library(multcomp)
example(plot.cld)
Also, a quick "multiple comparison plot" search at http://rseek.org reveals a few more packages and Task Views.
There are some methods around for multiple comparisons in GLMs
http://www.r-bloggers.com/multiple-comparisons-for-glmms-using-glmer-glht/
There is an article about simultaneous inference from the R-Project Handbook of Statistical Analyses (website) ...
http://cran.r-project.org/web/packages/HSAUR2/vignettes/Ch_simultaneous_inference.pdf
plotmeans() from the gplot package. That includes confidence intervals.
Then there is a error.bars.by() function of the package "psych". Plots the means and SDs groupwise from a dataframe.
Some use density plots for visualization.
# Compare MPG distributions for cars with
# 4,6, or 8 cylinders
library(sm)
attach(mtcars)
# create value labels
cyl.f <- factor(cyl, levels= c(4,6,8),
labels = c("4 cylinder", "6 cylinder", "8 cylinder"))
# plot densities
sm.density.compare(mpg, cyl, xlab="Miles Per Gallon")
title(main="MPG Distribution by Car Cylinders")
# add legend via mouse click
colfill<-c(2:(2+length(levels(cyl.f))))
legend(locator(1), levels(cyl.f), fill=colfill)
精彩评论