- Introduced by
- Olive Jean Dunn
- Year
- 1964
- Type
- Nonparametric pairwise comparison
What does it do?
Dunn's test is a nonparametric post-hoc procedure introduced by Olive Jean Dunn in 1964 to identify which specific pairs of groups differ significantly after a Kruskal-Wallis test has returned a significant overall result.
It compares groups pairwise using rank sums and applies a multiple-comparison correction — most commonly Bonferroni or Holm — to control the family-wise error rate.
The intuition behind the method
When a Kruskal-Wallis test tells you that at least one group differs from the others, it does not say which pair is responsible. Dunn's test answers that follow-up question by comparing every pair of groups on the same rank scale that Kruskal-Wallis used, then adjusting each pairwise p-value so that the chance of a false positive across all comparisons stays under control. Think of it as a disciplined way of doing all the pairwise inspections you want without inflating your Type I error.
History
Olive Jean Dunn published the rank-sum multiple-comparison procedure in Technometrics in 1964. The cited paper presents the use of rank sums from a combined ranking of k independent samples as a convenient alternative to making a separate ranking for each pair of samples, and it gives the asymptotic normal-table approach and a numerical example. The procedure is used as the post-hoc counterpart to the Kruskal-Wallis test. The Holm step-down correction is commonly preferred over the Bonferroni adjustment because it is never less powerful while still controlling the family-wise error rate.
When to use it
Use Dunn's test as a follow-up to a statistically significant Kruskal-Wallis test when you have three or more independent groups, a continuous or ordinal outcome, and no credible basis for the normality assumption of one-way ANOVA. A significant Kruskal-Wallis result is the conventional prerequisite for interpreting pairwise comparisons, since it indicates a difference somewhere among the groups; Dunn (1964) itself does not state this requirement. Running Dunn's test after a non-significant Kruskal-Wallis result is discouraged. Key assumptions are: independent observations within and between groups, an outcome that can be meaningfully ranked, group sizes large enough for the normal approximation to be reasonable, and distribution shapes that are not radically different if differences are to be read as location shifts. For repeated measures on the same subjects, the matching post-hoc procedure is the Nemenyi test after a Friedman test.
Limitations and considerations
- Can only be used after a significant Kruskal-Wallis test; it is not a stand-alone comparison procedure.
- Less powerful than parametric post-hoc tests such as Tukey's HSD when the data genuinely follow a normal distribution.
- Bonferroni correction becomes conservative as the number of pairwise comparisons grows, reducing power; Holm's step-down method is generally the better choice in that case.
- The test is built on pooled mean ranks, so a significant pair may reflect a shift in rank location or a difference in distribution shape, not necessarily a difference in medians.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Distribution-free: requires no normality assumption, making it safe for skewed or ordinal data.
- Directly extends the Kruskal-Wallis rank framework, so pairwise comparisons are consistent with the omnibus test.
- Multiple-comparison control via Bonferroni or Holm keeps family-wise Type I error at the nominal level.
- Simple to compute and widely implemented; effect size r = z / √N is straightforward to interpret.
Applications
- Identifying which treatment conditions differ after a significant Kruskal-Wallis test in clinical trials where continuous outcomes are non-normal.
- Post-hoc comparison of ordinal Likert-scale responses across three or more demographic or experimental groups.
- Environmental and ecological studies comparing species counts or pollution levels across multiple sites.
- Education research comparing ranked assessment scores among several instructional methods.
- Quality engineering: pinpointing which production conditions yield different defect rates after a nonparametric omnibus test.
How it works
How it works
For every pair of groups (i, j), the null hypothesis states that the two groups have the same mean rank under the pooled ranking of all observations, and the alternative states that their mean ranks differ. The test therefore targets differences in rank location rather than a full test of identical distributions. Under the further assumption that the group distributions have similar shapes, a difference in mean rank can be read as a shift in location. All pairwise hypotheses are tested together, which is why a multiple-comparison correction is required.
Formula
H_0:\ \theta_i = \theta_j \quad H_1:\ \theta_i \neq \theta_j \quad \text{for each pair } (i,j)Each pairwise z statistic divides the difference between the two groups' mean ranks by a standard error that depends on the total sample size N (all observations in the pooled ranking) and the two group sizes nᵢ and nⱼ, as given in the formula. A positive z means that the mean rank of group i exceeds that of group j. The z value is referred to the standard normal distribution to obtain a raw p-value for that pair; Dunn (1964) describes this asymptotic use of normal tables, so p-values are approximate when groups are small. The displayed formula is the variance for data without tied values. When the data contain ties, the variance must be adjusted for ties, a treatment discussed in Dunn (1964); software usually applies this adjustment automatically.
Formula
z_{ij} = \dfrac{\bar{R}_i - \bar{R}_j}{\sqrt{\dfrac{N(N+1)}{12}\left(\dfrac{1}{n_i} + \dfrac{1}{n_j}\right)}}Each raw p-value is adjusted for the number of pairwise comparisons using the Bonferroni method (multiply by the number of pairs) or the step-down Holm procedure. A pair is declared significantly different when its adjusted p-value falls below the chosen threshold, typically 0.05. As a commonly used convention (not part of Dunn's 1964 paper), an effect size can be reported as r = z / √N, where N is the same total pooled sample size used in the z statistic. Report the sign of z with r, so the direction of the difference (which group has the higher mean rank) is clear.
Formula
\text{reject } H_0 \text{ if } p_{\text{adj}} < 0.05;\quad r = \dfrac{z_{ij}}{\sqrt{N}}Common pitfalls
- Running Dunn's test after a non-significant Kruskal-Wallis result, contrary to the usual convention.
- Omitting the multiple-comparison correction and reporting raw p-values, which inflates the false-positive rate.
- Reporting only adjusted p-values without any effect size or direction for each significant pair.
- Using the untied-ranks variance on data with many ties without a tie adjustment.
- Confusing Dunn's test with the Nemenyi test — Nemenyi is the appropriate post-hoc for the Friedman test (repeated measures), not Kruskal-Wallis.
Frequently asked questions
Do I need to run Kruskal-Wallis first?
Yes. Dunn's test is a post-hoc procedure and should only be run after a statistically significant Kruskal-Wallis result. Running it without a significant omnibus test increases the probability of spurious findings.
Bonferroni or Holm: which correction should I use?
Holm's step-down method is never less powerful than Bonferroni while still controlling the family-wise error rate at the same nominal level, so it is generally preferred. Bonferroni is simpler and widely accepted, but with many groups it becomes increasingly conservative. Report whichever you use and apply it consistently.
How do I report effect size?
For each significant pair, calculate r = z / √N, where z is the pairwise z statistic and N is the total sample size across the two groups in the comparison. Report the value together with the direction of the difference. The cited source does not provide interpretation thresholds for this quantity, so any verbal labels should be justified by your field's conventions and stated explicitly.
Why not just run multiple Mann-Whitney U tests instead?
Running multiple Mann-Whitney tests without correction inflates the family-wise Type I error. Dunn's test uses the same pooled ranking as Kruskal-Wallis and applies a multiple-comparison correction, making it both conceptually consistent with the omnibus test and statistically appropriate for many pairs.
Related methods
Sources
Dunn, O.J. (1964). Multiple Comparisons Using Rank Sums. Technometrics, 6(3), 241–252.
Open DOI reference