
Conover's Test for Pairwise Rank Comparisons After a Kruskal–Wallis Test
Source:R/conoverTest.R
conoverTest.RdA nonparametric post hoc test for multiple pairwise comparisons following a significant Kruskal-Wallis test, based on rank data.
Arguments
- x
a numeric vector of observations or a list of numeric vectors.
- ...
further arguments passed to methods.
- formula
a formula of the form
response ~ group.- data
an optional data frame containing the variables in
formula.- subset
an optional expression specifying a subset of observations.
- na.action
a function indicating how missing values should be handled.
- g
a grouping variable corresponding to
x; ignored whenxis a list.- method
the method used to adjust the p-values for multiple comparisons, one of
p.adjust.methods(default is"holm"). Passed directly top.adjust().- alternative
a character string specifying the alternative hypothesis, must be one of
"two.sided"(default),"less"or"greater". See the Details for the direction convention.- output
the output format:
"list"pairwise comparison table."matrix"lower-triangular matrix of adjusted p-values.
- alpha
the significance level used to compile the groups flagged as significantly different in the label attribute of the p-value matrix (default is
0.05).
Value
An object of class "rankTest" containing:
respairwise comparison results. Depending on
output, either a table of mean-rank differences and adjusted p-values or a lower-triangular p-value matrix.pmatsymmetric matrix of adjusted p-values.
Details
conoverTest performs the post hoc pairwise multiple-comparison
procedure appropriate after rejection of the Kruskal-Wallis null
hypothesis. The test is based on the Conover-Iman rank-sum statistic and
is generally more powerful than Dunn's procedure. It is intended as a
post hoc procedure following a significant Kruskal-Wallis test, i.e.
typically for three or more groups.
Interpretation in terms of stochastic dominance requires the additional assumption that the cumulative distribution functions of the compared groups do not cross.
If x is a list, its elements are taken as the samples to be
compared and must be numeric vectors. In this case g is ignored.
Otherwise, x must be a numeric vector and g a grouping
variable of the same length.
Each pairwise comparison is labeled "B-A", where A precedes
B in the ordering of the group levels, and reports the mean rank
difference \(\bar{R}_B - \bar{R}_A\). For one-sided alternatives,
"greater" tests whether B tends to have larger observations
than A (upper tail), and "less" tests the reverse (lower
tail).
References
Conover, W. J. and Iman, R. L. (1979) On multiple-comparisons procedures. Technical Report LA-7677-MS, Los Alamos Scientific Laboratory.
Conover, W. J. (1999) Practical Nonparametric Statistics, 3rd ed., Hoboken, NJ: Wiley.
See also
kruskal.test(), wilcox.test(), p.adjust()
Other test.posthoc:
dscfTest(),
dunnTest(),
dunnettTest(),
gamesHowellTest(),
nemenyiTest(),
plot.PostHocTest(),
postHoc,
scheffeTest(),
signifDiff(),
steelTest()
Examples
## Hollander & Wolfe (1973), p. 116
x <- c(2.9, 3.0, 2.5, 2.6, 3.2)
y <- c(3.8, 2.7, 4.0, 2.4)
z <- c(2.8, 3.4, 3.7, 2.2, 2.0)
conoverTest(list(x, y, z))
#>
#> Conover's test of multiple comparisons : holm
#>
#> mean.rank.diff pval
#> 2-1 1.8 1.0000
#> 3-1 -0.6 1.0000
#> 3-2 -2.4 1.0000
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#>
x <- c(x, y, z)
g <- factor(
rep(1:3, c(5, 4, 5)),
labels = c(
"Normal subjects",
"Subjects with obstructive airway disease",
"Subjects with asbestosis"
)
)
kruskal.test(x, g)
#>
#> Kruskal-Wallis rank sum test
#>
#> data: x and g
#> Kruskal-Wallis chi-squared = 0.77143, df = 2, p-value = 0.68
#>
conoverTest(x, g)
#>
#> Conover's test of multiple comparisons : holm
#>
#> mean.rank.diff
#> Subjects with obstructive airway disease-Normal subjects 1.8
#> Subjects with asbestosis-Normal subjects -0.6
#> Subjects with asbestosis-Subjects with obstructive airway disease -2.4
#> pval
#> Subjects with obstructive airway disease-Normal subjects 1.0000
#> Subjects with asbestosis-Normal subjects 1.0000
#> Subjects with asbestosis-Subjects with obstructive airway disease 1.0000
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#>
## Formula interface
conoverTest(Ozone ~ factor(Month), data = airquality)
#>
#> Conover's test of multiple comparisons : holm
#>
#> mean.rank.diff pval
#> 6-5 12.02991453 0.8843
#> 7-5 41.21153846 1.9e-05 ***
#> 8-5 38.53846154 6.7e-05 ***
#> 9-5 11.99734748 0.5424
#> 7-6 29.18162393 0.0721 .
#> 8-6 26.50854701 0.1109
#> 9-6 -0.03256705 1.0000
#> 8-7 -2.67307692 1.0000
#> 9-7 -29.21419098 0.0031 **
#> 9-8 -26.54111406 0.0084 **
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#>