Dunn’s test
Ranks (nonparametric) · Multiple comparisons · reference distribution: N(0, 1)
When to use it
After a significant Kruskal-Wallis, find out which pairs of groups differ.
Null hypothesis
For each pair, the mean ranks are equal.
Assumptions
- The same as Kruskal-Wallis
Test statistic
z = \dfrac{\bar{R}_i - \bar{R}_j}{\sqrt{\dfrac{N(N+1)}{12}\left(\dfrac{1}{n_i} + \dfrac{1}{n_j}\right)}}Effect size
r for each pair, from the z of the test.
r = \dfrac{|z|}{\sqrt{n_i + n_j}}How to report it
B − A: z = 2.74, Holm-adjusted p = .018
In R and Python
library(FSA)
dunnTest(y ~ group, data = df, method = "holm")
import scikit_posthocs as sp
sp.posthoc_dunn(df, val_col="y", group_col="group", p_adjust="holm")
In Python, stats is scipy.stats and np is numpy.
Variants and alternatives
- Adjust the p-values of the comparisons (Bonferroni, Holm)
- Conover-Iman, slightly more powerful
Where it sits in the catalog
Ranks (nonparametric). Nonparametric tests assume no distribution for the data. They replace each value by its rank, its position in order (1st, 2nd, 3rd…), which protects them from extreme values and makes them fit ordinal data.
Multiple comparisons. Post hoc tests: after rejecting that all groups are equal, they point out which pairs differ, controlling the error of the whole set of comparisons.
In the decision tree
It has no path of its own in the tree, but appears alongside other tests:
- As a post hoc test, if H₀ is rejected, after Kruskal-Wallis.