A non-significant Kruskal-Wallis test does not prove that the groups being compared are equal — it means the test found insufficient evidence of a difference, which is not the same claim, especially with small samples where the test has low power to detect a real effect. And a significant result does not automatically mean “the medians differ”: the Kruskal-Wallis test is formally a test of whether the samples come from the same distribution, and it can be pushed to significance by a difference in spread or shape even when the medians are nearly identical. It is safe to interpret a significant result strictly as a difference in medians only when the group distributions have similar shape and spread and differ mainly in location. When shapes clearly differ, the honest interpretation is that the groups differ stochastically — one group tends to produce higher values than another — not specifically that their medians differ.
The Kruskal-Wallis test (also called the Kruskal-Wallis H test) is the non-parametric analogue of a one-way ANOVA: it compares three or more independent groups on a single outcome variable, but instead of comparing group means it converts every observation to a rank across the combined sample and compares mean ranks between groups. It is the extension, to more than two groups, of the logic behind the Mann-Whitney U test — in fact, run a Kruskal-Wallis test on exactly two groups and it reduces algebraically to a Mann-Whitney U test.
Kruskal-Wallis vs. one-way ANOVA: which assumption failed?
CASRAI’s dictionary covers what ANOVA is and how it partitions variance; this guide does not re-derive that. The practical question researchers usually have is which test to run given a specific problem with their data. The table below is a decision aid, not a substitute for checking your data directly.
| Situation | What’s actually violated | Use instead |
|---|---|---|
| Outcome is clearly non-normal and a transform (log, square-root) doesn’t fix it | Normality of residuals, the assumption one-way ANOVA relies on for small samples | Kruskal-Wallis test |
| Outcome is ordinal (Likert-type ratings, pain scores, stage/grade) rather than interval or ratio | ANOVA assumes a numeric scale where distances between values are meaningful | Kruskal-Wallis test |
| Small sample with one or two extreme outliers | ANOVA compares means, which outliers pull disproportionately | Kruskal-Wallis test (rank-based, far less sensitive to outlier magnitude) |
| Group variances are unequal but the outcome is otherwise reasonably normal | Homogeneity of variance, not normality | Welch’s ANOVA (unequal-variances ANOVA), not Kruskal-Wallis — Kruskal-Wallis also assumes similar spread across groups if you want to interpret the result as a median difference |
| Observations are repeated measures on the same subjects (e.g. three time points per participant) | Independence of observations, which both ANOVA and Kruskal-Wallis require | Friedman test, or a mixed-effects model |
| Only two groups being compared | Not an assumption failure — just the wrong test for two groups | Mann-Whitney U test (or an independent-samples t-test if normality holds) |
What the Kruskal-Wallis test actually does
The procedure ranks every observation from smallest to largest across the combined sample, ignoring which group it came from, then checks whether the average rank differs across groups by more than chance would produce. The test statistic, H, is compared against a chi-square distribution with k − 1 degrees of freedom, where k is the number of groups. Most statistical software applies a correction for tied ranks automatically — datasets with many repeated values (common with ordinal scales) produce a downward-biased H without it.
The null hypothesis is that all groups were sampled from the same underlying distribution. Rejecting it tells you the groups differ in location, spread, or shape — not specifically which one, and not which pairs of groups differ. That is what the post-hoc step below is for.
Assumptions and when not to use it
- Independent observations, both within and across groups. Kruskal-Wallis does not handle repeated measures or clustered/nested data — use the Friedman test or a mixed-effects model instead.
- The outcome is ordinal or continuous, measured on at least a rank-orderable scale. It is not valid for unordered categorical data — that’s the job of a chi-square test.
- Three or more groups. For exactly two, run a Mann-Whitney U test directly rather than Kruskal-Wallis with k=2; the result is mathematically equivalent but the terminology and effect-size conventions differ.
- Does not require normality — that is the entire point of using it. It does not require homogeneity of variance either, but similar spread and shape across groups is needed if you want to describe a significant result specifically as a difference in medians rather than a more general distributional difference.
- Not a fix for heteroscedasticity in an otherwise well-behaved outcome. If normality is fine but variances differ sharply, Welch’s ANOVA addresses that directly; switching to Kruskal-Wallis changes what hypothesis you’re testing, not just how you’re testing it.
Worked example: reading a Kruskal-Wallis output
Illustrative example (not real data): a researcher compares self-reported pain scores (0–10 ordinal scale) 48 hours post-procedure across three analgesic protocols, 8 patients per group (N = 24). The outcome is ordinal and the sample is small, so Kruskal-Wallis is used in place of a one-way ANOVA.
| Group | n | Median pain score | Sum of ranks | Mean rank |
|---|---|---|---|---|
| Protocol A | 8 | 3 | 62 | 7.75 |
| Protocol B | 8 | 5 | 100 | 12.50 |
| Protocol C | 8 | 7 | 138 | 17.25 |
The three groups’ mean ranks are 7.75, 12.50, and 17.25, spread noticeably around the overall average rank of 12.5. Working through the standard H formula on these sums of ranks gives H(2) = 7.22, which against a chi-square distribution with 2 degrees of freedom corresponds to p = .027.
The sentence a researcher would write from this: “A Kruskal-Wallis test indicated a statistically significant difference in reported pain scores across the three analgesic protocols, H(2) = 7.22, p = .027, ε² = .31.”
That sentence is where most write-ups stop — and it’s incomplete. An omnibus Kruskal-Wallis result only says at least one pair of groups differs; it does not say which pair. Reporting it alone, without a post-hoc step, leaves the reader unable to tell whether Protocol A differs from B, from C, or both.
The post-hoc step most write-ups omit: Dunn’s test
After a significant omnibus Kruskal-Wallis result, the standard follow-up is Dunn’s test (Dunn, 1964) — pairwise rank-sum comparisons that reuse the pooled ranking from the omnibus test, run for every pair of groups, with a multiple-comparison correction applied across all pairwise p-values (Bonferroni and Holm are both common choices; Holm is less conservative and generally preferable). Running plain pairwise Mann-Whitney U tests instead is a common shortcut, but it re-ranks each pair separately rather than using the full-sample ranking, which is part of why Dunn’s test, not pairwise Mann-Whitney, is the test most commonly recommended as the direct follow-up to Kruskal-Wallis.
Continuing the illustrative example, Dunn’s test with Bonferroni correction across the three pairwise comparisons might return:
| Comparison | p (unadjusted) | p (Bonferroni-adjusted) | Significant at α = .05? |
|---|---|---|---|
| Protocol A vs. Protocol B | .061 | .183 | No |
| Protocol A vs. Protocol C | .007 | .021 | Yes |
| Protocol B vs. Protocol C | .096 | .288 | No |
The full reporting sentence, with the post-hoc step included: “Dunn’s post-hoc pairwise comparisons with Bonferroni correction indicated that Protocol C produced significantly higher pain scores than Protocol A (padj = .021); no other pairwise comparison reached significance after correction.” That is the level of detail a results section needs — the omnibus statistic, the effect size, and which specific pairs the post-hoc test located the difference between.
Effect size: don’t stop at the p-value
A p-value says whether an effect was detected; it says nothing about how large that effect is, and with a large enough sample even a trivial difference in rank distribution becomes statistically significant. The two effect sizes most commonly reported alongside Kruskal-Wallis results are:
- Epsilon-squared (ε²): ε² = H / (N − 1), where N is the total sample size. In the worked example above, ε² = 7.22 / 23 = 0.31.
- Eta-squared H (η²H): η²H = (H − k + 1) / (N − k), a rank-based analogue of the eta-squared reported for a standard ANOVA.
Both range roughly from 0 to 1 and are interpreted similarly to other standardized effect sizes: a widely used convention (Rea & Parker) treats ε² below .01 as negligible, .01–.04 as weak, .04–.16 as moderate, .16–.36 as relatively strong, and above .36 as strong. As with any effect-size threshold, this is a convention for calibrating interpretation, not a rule that determines whether a result “counts.”
How to report a Kruskal-Wallis test
A complete report includes, at minimum: the test statistic with its degrees of freedom, the p-value, an effect size, and — if the omnibus test was significant — the post-hoc comparisons that located the difference. Report medians and interquartile ranges (not means and standard deviations) as the descriptive statistics for each group, since the test is rank-based and the median is the location measure it corresponds to.
Minimum template: “A Kruskal-Wallis test showed [a significant / no significant] difference in [outcome] across [grouping variable], H([df]) = [value], p = [value], ε² = [value]. [If significant:] Dunn’s post-hoc pairwise comparisons with [correction method] correction indicated that [group] differed significantly from [group] (padj = [value]).” This mirrors the structure CASRAI’s guide to reporting p-values recommends more generally: statistic, degrees of freedom or sample size, exact p-value, and effect size, together rather than any one alone.
Related checks before you commit to Kruskal-Wallis
Before switching away from a one-way ANOVA, confirm the assumption actually failed rather than assuming it did. CASRAI’s guide to checking the normality assumption covers the formal tests and visual checks (Q-Q plots, Shapiro-Wilk) used to make that call, and the guide to skewness covers how to describe the shape difference between groups that determines whether a significant Kruskal-Wallis result can be read as a difference in medians. If the outcome is genuinely categorical rather than ordinal or continuous, the correct comparison is a chi-square test, not Kruskal-Wallis. If the research question is about association or ranking between two continuous or ordinal variables rather than a difference between groups, see CASRAI’s guide to the correlation coefficient, including when Spearman’s rank correlation (the same rank-based logic as Kruskal-Wallis, applied to association rather than group comparison) is the appropriate choice.
Frequently asked questions
Is the Kruskal-Wallis test the same as ANOVA?
No. Both compare three or more groups on a single outcome, but ANOVA compares means and requires roughly normal, similarly-varying data; Kruskal-Wallis compares mean ranks and makes no normality assumption. They can give different answers on the same dataset, particularly when the data are skewed.
What does a significant Kruskal-Wallis result actually mean?
That at least one group’s distribution differs from at least one other group’s, by more than chance would plausibly produce. It does not identify which groups differ — that requires a post-hoc test such as Dunn’s test — and it should only be read as a difference in medians specifically when the group distributions have similar shape and spread.
Do I always need a post-hoc test after Kruskal-Wallis?
Only if the omnibus result is significant and you have three or more groups. With a non-significant omnibus result, running pairwise comparisons anyway inflates the false-positive rate and is generally discouraged. With exactly two groups there is no “post-hoc” step because there is only one comparison to make.
What’s the difference between Kruskal-Wallis and the Mann-Whitney U test?
They are the same underlying rank-based logic; Mann-Whitney U is specifically for two independent groups, and Kruskal-Wallis is its extension to three or more. Running Kruskal-Wallis on exactly two groups reduces mathematically to the Mann-Whitney U result.
Can Kruskal-Wallis compare medians directly?
Only under an added condition: the group distributions need similar shape and spread, differing mainly in location. Formally, the test compares whole distributions, not medians specifically. When shapes clearly differ across groups, describe a significant result as a general distributional difference (or in terms of stochastic dominance) rather than asserting the medians differ.
Why did my Kruskal-Wallis and pairwise Mann-Whitney U results disagree with my Dunn’s test results?
Plain pairwise Mann-Whitney U tests re-rank each pair of groups separately, discarding information from the other groups in the dataset; Dunn’s test reuses the single combined ranking from the omnibus Kruskal-Wallis test. The two approaches can disagree, particularly with unequal group sizes, which is part of why Dunn’s test is the more commonly recommended post-hoc for Kruskal-Wallis specifically.







