AI Glossary / Statistics and probability / Intermediate

Kruskal­Wallis one-way analysis of variance

Definition

The Kruskal - Wallis one-way analysis of variance is a rank-based test for comparing independent groups on an ordered or numerical outcome. It pools observations, ranks them and assesses whether group rank distributions differ more than expected under the null of identical population distributions. It is often described as a nonparametric alternative to one-way ANOVA, but it does not simply test equality of arithmetic means. Interpreting it specifically as a test of median differences requires additional assumptions about the shapes of the group distributions.

What it means

The test replaces original measurements with their positions in the combined sample. Groups with systematically larger observations tend to receive larger rank sums. This reduces dependence on the numerical spacing between outcomes and avoids the normal-error assumption of classical ANOVA. However, ranking does not eliminate every modeling issue. Observations must be appropriately independent, and the test's meaning depends on the null and alternative being considered. Differences in spread or shape can affect results, so a rejection should not automatically be translated into a claim that every group median differs.

How it works

For k groups, let nⱼ be each group size, Rⱼ its pooled rank sum and N the total sample size. Without ties, H = [12/(N(N + 1))]Σ(Rⱼ²/nⱼ) − 3(N + 1). Assign tied observations their average ranks. Divide H by the tie correction 1 − Σ(t³ − t)/(N³ − N), summing over pooled tie groups of size t. A common large-sample calibration compares the corrected statistic with a chi-square distribution with k − 1 degrees of freedom. Small samples may require an appropriate exact or permutation procedure. A significant overall result does not identify which group comparisons differ.

Three practical examples

  • Service research: compare ordered satisfaction responses across independently sampled service groups, with attention to ties and group composition.
  • Process comparison: assess whether numerical outcomes from several independent operating settings have different rank patterns.
  • Experimental analysis: compare independent treatment groups when a rank-based hypothesis fits the research question. Repeated measurements on the same units need a method that accounts for the pairing or blocking instead.

Think of it this way

Think of combining all observations into one ordered queue, then examining where each group's members stand. A group concentrated near the front differs from one concentrated near the back. The test summarizes the separation of those group rank totals. It deliberately discards the distances between neighboring positions, so it answers a different question from comparing average differences measured in the original units.

Worked example

Consider independent groups A = (1, 2, 2), B = (3, 4, 5) and C = (6, 7, 8). The pooled ranks are 1, 2.5, 2.5, 4, 5, 6, 7, 8 and 9. Rank sums are 6, 15 and 24, and N = 9. The uncorrected statistic is (12/90)(6²/3 + 15²/3 + 24²/3) − 30 = 7.2. The tied pair gives correction 1 − (2³ − 2)/(9³ − 9) = 119/120. The corrected H is 7.2/(119/120) = 864/119, approximately 7.2605. A chi-square approximation with two degrees of freedom gives p approximately 0.02651. With only three observations per group, that approximation deserves caution. Enumerating all 1,680 allocations of these nine labeled observations into three labeled groups of size three gives six allocations with H at least as large, for an exact permutation p-value of 1/280, approximately 0.003571, under exchangeability. The contrast illustrates why calibration matters.

Illustrative case study

Fictional case study: Birch Service compares satisfaction ratings across three independently sampled locations. A Kruskal - Wallis result suggests different rank patterns, but the analyst finds many tied responses and differing customer mixes. The team reports the tie treatment, examines group distributions and uses adjusted follow-up comparisons where appropriate. It avoids describing the overall result as proof that all locations differ or that location caused the difference. The analysis provides a focused statistical comparison while preserving the limits of its observational design.

Common misconceptions and mistakes

Common mistakes include calling the procedure a test of means, assuming it always tests medians regardless of distribution shape, and ignoring ties. Ranking does not make dependent observations independent. Small group sizes can make the usual chi-square approximation inaccurate. If all values are tied, the standard tie-corrected formula is degenerate. Post-hoc comparisons need suitable multiplicity control and cannot be inferred from the omnibus result alone. A p-value does not measure the size or practical importance of differences, so include descriptive distributions and an appropriate effect-size summary.

Business use

Businesses can use the test when independent-group rank comparisons match the question and the measurement scale supports ordering. Define the groups and outcomes in advance, inspect the data and explain why this test addresses the decision. Report group sizes, descriptive summaries, the statistic, tie treatment and p-value calibration. Separate the overall test from subsequent pairwise analysis. If the operational question concerns a mean cost or a particular quantile, use or supplement with methods that directly address that quantity rather than assuming a rank test answers it automatically.

People also ask

Is this appropriate for repeated measurements on the same people?

Not in its ordinary independent-group form; a paired or blocked method is needed.

Does rejection show every group differs?

No. It indicates evidence against the overall null, not every pairwise null.

Can tied observations be included?

Yes, with average ranks and the appropriate correction or resampling treatment.

Check your understanding

Why do the two p-values in the example differ?

Answer: One uses an asymptotic chi-square approximation, while the other enumerates the finite permutation distribution under exchangeability. They calibrate the same statistic differently, which can matter in a very small sample.

Related terms

  • One-way ANOVA
  • Friedman test
  • Permutation test
  • Multiple comparisons
  • pooled ranks
  • Mann–Whitney test
  • tie correction

Learn next

calculate pooled ranks and the tie correction manually, then compare asymptotic and permutation calibration. Inspect examples with equal medians but different shapes to understand why a general distributional interpretation is safer without additional assumptions.

More in Statistics and probability

  • Knockoffs (statistics) - Knockoffs are synthetic comparison variables used in statistical procedures for selecting relevant predictors while controlling the false discovery rate...
  • Kolmogorov-Smirnov test - The Kolmogorov - Smirnov test is a distribution-comparison test based on the largest vertical difference between cumulative distribution functions.
  • Kriging - Kriging is a family of prediction methods that use a modeled covariance or variogram to combine observed values when estimating an unobserved value, often...
  • Kuiper's test - Kuiper's test is a goodness-of-fit or two-sample distribution-comparison test based on the sum of the largest upward and downward differences between...
  • Kurtosis - Kurtosis is a standardized fourth-moment measure of a distribution.
  • Lack of fit - Lack of fit is systematic disagreement between a model's assumed relationship and the pattern supported by the data.

Sources

Sources: SciPy, kruskal documentation, https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.kruskal.html. D. C. Howell, statistical glossary, https://www.uvm.edu/~statdhtx/methods8/Glossary/Glossary.html. The dataset, exact allocation calculation and fictional case are original illustrations.

Previous: Kronecker product Next: Kuiper's test

  • Home
  • Daily AI Updates
  • Blog
  • AIFBL Academy
  • AI Glossary
  • Products and Tools
  • Store
  • Free CFO AI Prompt Pack
  • About Shihan Sheriff
  • Privacy Policy
  • Terms of Use
  • Refund Policy
  • Cookie Policy
  • Earnings Disclaimer