Performs Tukey's all-pairs comparisons test for normally distributed data with equal group variances.
tukeyTest(x, ...)# S3 method for default
tukeyTest(x, g, ...)
# S3 method for formula
tukeyTest(formula, data, subset, na.action, ...)
a numeric vector of data values, or a list of numeric data vectors.
further arguments to be passed to or from methods.
a vector or factor object giving the group for the
corresponding elements of "x"
.
Ignored with a warning if "x"
is a list.
a formula of the form response ~ group
where
response
gives the data values and group
a vector or
factor of the corresponding groups.
an optional matrix or data frame (or similar: see
model.frame
) containing the variables in the
formula formula
. By default the variables are taken from
environment(formula)
.
an optional vector specifying a subset of observations to be used.
a function which indicates what should happen when
the data contain NA
s. Defaults to getOption("na.action")
.
A list with class "PMCMR"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
lower-triangle matrix of the estimated quantiles of the pairwise test statistics.
lower-triangle matrix of the p-values for the pairwise tests.
a character string describing the alternative hypothesis.
a character string describing the method for p-value adjustment.
a data frame of the input data.
a string that denotes the test distribution.
For all-pairs comparisons in an one-factorial layout
with normally distributed residuals and equal variances
Tukey's test can be performed. A total of
The p-values are computed from the Tukey-distribution.
L. Sachs (1997) Angewandte Statistik, New York: Springer.
J. Tukey (1949) Comparing Individual Means in the Analysis of Variance, Biometrics 5, 99--114.
# NOT RUN {
set.seed(245)
mn <- rep(c(1, 2^(1:4)), each=5)
sd <- rep(1, 25)
x <- mn + rnorm(25, sd = sd)
g <- factor(rep(1:5, each=5))
fit <- aov(x ~ g)
shapiro.test(residuals(fit))
bartlett.test(x ~ g) # var1 = varN
anova(fit)
summary(tukeyTest(x, g))
# }
Run the code above in your browser using DataLab