Performs Conover's test (also known as the Conover-Iman test) for
pairwise multiple comparisons of the ranked data, following a significant
Kruskal-Wallis test. It is closely related to dunn_test(), but
uses the pooled within-group rank variance and refers the test statistic to a
t-distribution (with \(N - k\) degrees of freedom) instead of the
standard normal distribution. The Conover-Iman test is generally more
powerful than Dunn's test, but should only be used as a post-hoc procedure
when the Kruskal-Wallis test is itself significant (Conover, 1999).
If a reference group is specified (via ref.group), then each of the
remaining group levels is compared only to the reference (control) group, and
the p-value adjustment for multiple comparisons is computed over only these
k - 1 comparisons (instead of all k(k - 1)/2 pairwise
comparisons), exactly as for dunn_test().
See the Datanovia tutorial Kruskal-Wallis Test in R for a worked walkthrough.
conover_test(
data,
formula,
p.adjust.method = "holm",
ref.group = NULL,
detailed = FALSE
)return a data frame with some of the following columns:
.y.: the y (outcome) variable used in the test.
group1,group2: the compared groups in the pairwise tests.
n1,n2: Sample counts.
estimate: mean ranks difference.
estimate1, estimate2: show the mean rank values of the two
groups, respectively.
statistic: Test statistic (t-value) used
to compute the p-value.
df: degrees of freedom (\(N - k\),
the same for every comparison).
p: p-value.
p.adj:
the adjusted p-value.
method: the statistical test used to
compare groups.
p.adj.signif: the significance level of the
adjusted p-values.
The returned object has an attribute called args, which is a list holding the test arguments.
a data.frame containing the variables in the formula.
a formula of the form x ~ group where x is a
numeric variable giving the data values and group is a factor with
one or multiple levels giving the corresponding groups. For example,
formula = TP53 ~ cancer_group.
method to adjust p values for multiple comparisons. Used when pairwise comparisons are performed. Allowed values include "holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none". If you don't want to adjust the p value (not recommended), use p.adjust.method = "none".
a character string specifying the reference group. If
specified, for a given grouping variable, each of the group levels will be
compared to the reference (control) group, and the p-value adjustment is
computed over only these comparisons. Note that, like dunn_test(),
conover_test() does not support ref.group = "all".
logical value. Default is FALSE. If TRUE, a detailed result is shown.
The Conover-Iman pairwise statistic for comparing groups \(i\) and \(j\) is $$t_{ij} = \frac{\bar{R}_i - \bar{R}_j}{\sqrt{S^2 \, \frac{N - 1 - H}{N - k} \left(\frac{1}{n_i} + \frac{1}{n_j}\right)}}$$ where \(\bar{R}\) are the mean ranks, \(H\) is the (tie-corrected) Kruskal-Wallis statistic, \(N\) is the total sample size, \(k\) is the number of groups, and \(S^2\) is the variance of the ranks (\(S^2 = N(N+1)/12\) when there are no ties; otherwise \(S^2 = \frac{1}{N - 1}\left(\sum r^2 - \frac{N(N+1)^2}{4}\right)\)). The statistic is referred to a t-distribution with \(N - k\) degrees of freedom.
In the returned table each row is oriented with \(i = \) group2 and
\(j = \) group1: estimate is \(\bar{R}_{group2} -
\bar{R}_{group1}\) and statistic carries its sign, the same convention
as dunn_test().
The results match PMCMRplus::kwAllPairsConoverTest().
Conover, W. J. (1999) Practical Nonparametric Statistics, 3rd edition. Wiley.
Conover, W. J. and Iman, R. L. (1979) On multiple-comparisons procedures. Technical Report LA-7677-MS, Los Alamos Scientific Laboratory.
dunn_test, kruskal_test
The Datanovia tutorial: Kruskal-Wallis Test in R.
# Simple test
ToothGrowth %>% conover_test(len ~ dose)
# Comparison against a reference (control) group
# each group is compared to the reference; the p-value
# adjustment corrects for only these k - 1 comparisons
ToothGrowth %>% conover_test(len ~ dose, ref.group = "0.5")
# Grouped data
ToothGrowth %>%
group_by(supp) %>%
conover_test(len ~ dose)
Run the code above in your browser using DataLab