TukeyHSD(x, which, ordered = FALSE, conf.level = 0.95, ...)aov fit.ordered is true then
the calculated differences in the means will all be positive. The
significant differences will be those for which the lwr end
point is positive.c("multicomp", "TukeyHSD"),
with one component for each term requested in which.
Each component is a matrix with columns diff giving the
difference in the observed means, lwr giving the lower
end point of the interval, upr giving the upper end point
and p adj giving the p-value after adjustment for the multiple
comparisons.There are print and plot methods for class
"TukeyHSD". The plot method does not accept
xlab, ylab or main arguments and creates its own
values for each plot.
John Tukey introduced intervals based on the range of the sample means rather than the individual differences. The intervals returned by this function are based on this Studentized range statistics.
The intervals constructed in this way would only apply exactly to balanced designs where there are the same number of observations made at each level of the factor. This function incorporates an adjustment for sample size that produces sensible intervals for mildly unbalanced designs.
If which specifies non-factor terms these will be dropped with
a warning: if no terms are left this is a an error.
In R 2.15.2 and earlier the results were NA for fits with
na.action methods such as na.exclude.
Yandell, B. S. (1997) Practical Data Analysis for Designed Experiments. Chapman & Hall.
aov, qtukey, model.tables,
glht in package \href{https://CRAN.R-project.org/package=#1}{\pkg{#1}}multcompmultcomp.
require(graphics)
summary(fm1 <- aov(breaks ~ wool + tension, data = warpbreaks))
TukeyHSD(fm1, "tension", ordered = TRUE)
plot(TukeyHSD(fm1, "tension"))
Run the code above in your browser using DataLab