Kruskal-Wallis Test
Nonparametric replacement for one-way ANOVA. H statistic, p-value, Dunn post-hoc and effect size.
When to use it
Use as the rank-based alternative to one-way ANOVA when residuals are heavily non-normal, when group sizes are very small, or when the response is ordinal rather than continuous. Tests whether the distributions of three or more independent groups are stochastically different.
When NOT to use it
Do not use for two groups (use Mann-Whitney U). Do not use for paired data across conditions (use Friedman). If ANOVA assumptions hold, prefer ANOVA; it has more power. Do not interpret as a test of equal medians unless the within-group distributions are similar in shape.
What you get
Kruskal-Wallis H statistic with df = k - 1 and p, with the tie-corrected variant where ties are present; rank means per group; Dunn post-hoc with letter display when k > 2; epsilon-squared and eta-squared (rank-based) effect sizes.
How to interpret the output
Reject the null when H is large (or equivalently when p is below alpha). The Dunn post-hoc handles which groups differ, with optional Bonferroni or Holm adjustment for the family of pairwise tests. Epsilon-squared above 0.16 is conventionally a large effect (Tomczak and Tomczak 2014). H is on the chi-square scale and the p uses the chi-square approximation, valid when group sizes are at least 5.
Common pitfalls
- Calling Kruskal-Wallis a test of medians without checking distribution shape.
- Using it routinely instead of ANOVA when ANOVA assumptions actually hold (loses power).
- Forgetting to apply a multiple-comparisons correction in the Dunn post-hoc.
- Ignoring tie corrections when the data have many repeated values.
Try it in StatVeda
The Kruskal-Wallis (k groups) engine runs entirely in the browser. No signup, no install, no data sent to a server. Paste your data, hit Run, copy the output.
Open Kruskal-Wallis (k groups)References
- Kruskal, W. H. and Wallis, W. A. (1952). Use of ranks in one-criterion variance analysis. Journal of the American Statistical Association, 47(260), 583 to 621.
- Dunn, O. J. (1964). Multiple comparisons using rank sums. Technometrics, 6(3), 241 to 252.
- Hollander, M., Wolfe, D. A. and Chicken, E. (2014). Nonparametric Statistical Methods, 3rd edition. John Wiley and Sons, Hoboken.