Kruskal–Wallis H Test Calculator
Compare three or more independent groups without assuming normal distributions. Paste one group per line to compute the tie-corrected Kruskal–Wallis H statistic, degrees of freedom, p-value, epsilon-squared (ε²) and η²_H effect sizes, Dunn's Bonferroni-adjusted pairwise comparisons, and an APA 7th reporting sentence.
| Statistic | Value |
|---|---|
| H | 15.16 |
| df | 2.00 |
| p-value | 5.11e-4 |
| ε² | .89 |
| η²_H | .88 |
| N | 18 |
| G1 (n=6, Median / Mean rank) | 79.50 / 9.50 |
| G2 (n=6, Median / Mean rank) | 89.00 / 15.50 |
| G3 (n=6, Median / Mean rank) | 70.50 / 3.50 |
APA report
H(2.00) = 15.16, p < .001, ε² = .89
Dunn's pairwise comparisons (Bonferroni-adjusted p)
- G1 vs G2: ΔR̄ = -6.00, z = -1.95, p(adj) = 0.155
- G1 vs G3: ΔR̄ = 6.00, z = 1.95, p(adj) = 0.155
- G2 vs G3: ΔR̄ = 12.00, z = 3.89, p(adj) = 2.97e-4
Running one test at a time? Upload your .csv or .xlsx file (up to 10 MB) to Data2Paper Generate Paper to compute all variables in Python and export a complete structured research manuscript—preview the first half free before the $19.90 one-time unlock.
- Baseline Table 1 & multi-variable APA 7th statistical tables
- Publication-ready charts & figures generated from your uploaded rows
- Complete Methods, Results & Discussion with OpenAlex/Crossref DOIs
- Editable Word (.docx), LaTeX (.tex), PDF & source ZIP ($19.90 one-time)
How to use this calculator
1. Paste **one independent group per line** into the input box (separate numbers within each group using commas, spaces, or tabs—copy rows or transposed columns straight from Excel, SPSS, or CSV). 2. Include at least **three groups** for a multi-group non-parametric omnibus test (with two groups, Kruskal–Wallis gives the same asymptotic result as Mann–Whitney U). 3. Inspect the tie-corrected **H** statistic, **df** (`k − 1`), **p-value**, omnibus effect sizes **ε²** and **η²_H**, per-group medians and mean ranks, boxplot visualization, and **Dunn's pairwise post-hoc comparisons** with Bonferroni-adjusted *p*-values.
When to use the Kruskal–Wallis H test
The Kruskal–Wallis *H* test is the rank-based non-parametric counterpart of one-way ANOVA. Choose it when:
- You have **three or more independent groups** (e.g., three clinical dosing arms, four Likert satisfaction cohorts, or multiple teaching conditions).
- The outcome is **ordinal** (Likert items, pain scales, clinical staging) or **skewed continuous data** where one-way ANOVA's normality assumption is untenable.
For **three or more approximately normal continuous groups**, use the [one-way ANOVA calculator](/tools/anova-calculator). For **two independent groups**, use the [Mann–Whitney U test calculator](/tools/mann-whitney-u-test-calculator). For **two paired measurements** on the same participants, use the [Wilcoxon signed-rank calculator](/tools/wilcoxon-signed-rank-calculator).
Assumptions
- **Independence:** observations are independent both within and across groups; each participant belongs to only one group.
- **Ordinal or continuous outcome:** all observations across groups can be combined and ranked meaningfully.
- **Distribution shape and medians:** Kruskal–Wallis always tests whether at least one group stochastically dominates another (mean ranks differ). When all groups share a similar distribution shape and spread, a significant *H* can also be interpreted as a difference in group medians.
Formulas
Pool all `N = Σ n_i` observations across `k` groups and assign ranks `1 … N` (ties receive average ranks). Let `R_i` be the sum of ranks in group `i`:
- Uncorrected statistic: `H_0 = [12 / (N(N + 1))] Σ (R_i² / n_i) − 3(N + 1)`
- Tie correction factor: `C = 1 − Σ(t³ − t) / (N³ − N)`, giving `H = H_0 / C` on `df = k − 1` (chi-square distribution).
- **Epsilon-squared:** `ε² = H / (N − 1)` (ranges from 0 to 1).
- **Eta-squared based on H:** `η²_H = (H − k + 1) / (N − k)`.
- **Dunn's post-hoc test:** compares mean ranks `|R̄_i − R̄_j|` divided by `SE = √[ (N(N + 1)/12 − Σ(t³ − t)/(12(N − 1))) × (1/n_i + 1/n_j) ]`, with Bonferroni adjustment across `k(k − 1)/2` pairs.
Worked example
Eighteen students (`n = 6` per group) are assigned to three study formats and evaluated on a mastery rubric:
| Group | Scores | n | Median | Rank Sum (R_i) | Mean Rank (R̄_i) | |---|---|---|---|---|---| | G1 (Lecture) | 78, 82, 75, 80, 84, 79 | 6 | 79.50 | 57.0 | 9.50 | | G2 (Active Lab) | 86, 90, 88, 92, 87, 91 | 6 | 89.00 | 93.0 | 15.50 | | G3 (Self-Study) | 68, 72, 70, 74, 69, 71 | 6 | 70.50 | 21.0 | 3.50 |
- **H(2) = 15.16, p < .001** (`p = 0.00051`, verified with `scipy.stats.kruskal`)
- **ε² = .89**, **η²_H = .88**
- **Dunn's post-hoc comparisons (Bonferroni):**
- - G2 vs G3: `ΔR̄ = 12.00, z = 3.89, p(adj) < .001`
- - G2 vs G1: `ΔR̄ = 6.00, z = 1.95, p(adj) = .155`
- - G1 vs G3: `ΔR̄ = 6.00, z = 1.95, p(adj) = .155`
Reporting in APA 7th style
State the Kruskal–Wallis statistic `H` with degrees of freedom, exact `p`-value, omnibus effect size (`ε²` or `η²_H`), group medians (or mean ranks), and post-hoc pairwise comparisons:
> A Kruskal–Wallis test showed a significant difference in mastery scores across the three study conditions, *H*(2) = 15.16, *p* < .001, ε² = .89. Dunn's Bonferroni-adjusted pairwise comparisons indicated that Active Lab (*Mdn* = 89.00, mean rank = 15.50) scored significantly higher than Self-Study (*Mdn* = 70.50, mean rank = 3.50), *z* = 3.89, *p* < .001.
Working from a multi-column CSV or Excel dataset? Upload your file to Data2Paper's [Generate Paper](/generate-paper) or [SPSS/CSV to APA Results workflow](/spss-to-apa-results-generator) to execute baseline Table 1 comparisons, non-parametric tests, figures, and APA 7th Results & Discussion sections in Word, LaTeX, and PDF (free first-half preview before $19.90 one-time unlock).