Kruskal-Wallis Test Calculator
Run a Kruskal-Wallis non-parametric one-way ANOVA test.
Compare 2 to 5 groups using the H statistic, chi-squared p-value, and automatic tie correction.
Kruskal-Wallis Test
The Kruskal-Wallis test is a non-parametric alternative to the one-way ANOVA. Use it when the normality assumption of ANOVA cannot be met, or when working with ordinal data.
When to use it:
- Comparing 3 or more independent groups
- Data is not normally distributed
- Data is ordinal (ranked categories)
- Sample sizes are small
The H statistic:
H = (12 / (N(N+1))) * sum(R_i^2 / n_i) - 3(N+1)
Where:
- N = total number of observations across all groups
- k = number of groups
- n_i = number of observations in group i
- R_i = sum of ranks assigned to group i
Tie correction: When ties exist, H is divided by: C = 1 - (sum(t^3 - t)) / (N^3 - N) Where t = number of observations in each tied group.
Interpretation:
- H follows a chi-squared distribution with df = k - 1 (for large samples)
- A large H means the groups are likely different
- p < 0.05: reject the null hypothesis (groups likely differ)
- p >= 0.05: insufficient evidence groups differ
Null hypothesis: All groups come from the same distribution (equal medians).
Post-hoc testing: A significant Kruskal-Wallis result tells you that some groups differ, but not which ones. Follow up with pairwise Mann-Whitney U tests (with Bonferroni correction) to identify which pairs differ.
Important note: Kruskal-Wallis tests whether the distributions differ, not just the medians. It assumes the distributions have similar shapes (just potentially different locations).