Analyze · Nonparametric

Kruskal-Wallis Test

Compares the distributions of one continuous (or ordinal) variable across three or more independent groups using ranks: the nonparametric alternative to one-way ANOVA.

In the menus Analyze › Nonparametric › Kruskal-Wallis Test

Also searched as kruskal kruskal wallis h nonparametric anova non parametric anova rank anova dunn test compare medians of several groups

When to use it

You're comparing 3+ independent groups but the data are not normal, are ordinal, or contain outliers.

When not to: Data are roughly normal (one-way ANOVA is more powerful in that case), exactly two groups are being compared (use Mann-Whitney), the same subjects were measured repeatedly across conditions (use Friedman, not Kruskal-Wallis, since this test assumes independent groups), or the grouping column has more than 50 distinct levels, likely signaling an ID column rather than a real factor.

Step by step

  1. Open it from the menu

    Click Analyze in the menu bar; under Nonparametric choose Kruskal-Wallis Test.

  2. Fill in the form

    Choose the columns: What you measured, The groups. The form lists only columns whose type fits each field.

  3. Check the options

    The options start at their defaults: How strict to be, Which pairs differ (follow-up). Change one only when your question needs it.

  4. Run the analysis

    Press Run analysis. The Result Card opens on its Results tab.

What to choose in the form

Fields of the Kruskal-Wallis Test form
What you measured Numeric Var requiredOne numeric or ordered categorical column. A number or ordered column. The groups are compared by ranks, not averages.
The groups Group Var requiredOne categorical column. A category column with three or more groups.
How strict to be AlphaThe cut-off for the p-value. Below it, the card reports evidence of a difference; a smaller cut-off is stricter. Not sure? Keep 0.05. It is the usual convention in most fields.
Which pairs differ (follow-up) Post-hoc testWhen the overall test finds a difference, Dunn's test compares every pair, with a Bonferroni correction for the many comparisons. Not sure? Keep Dunn (Bonferroni). It tells you which groups differ.

How to read the card

The Results tab starts with what to know first (rows left out, checks that did not pass), then the interpretation in words and the Key Results; charts and assumption checks follow further down. Learn More explains the method in plain words. Read a Result Card covers all four tabs.

What it assumes

Independence of observations

If it does not hold: Kruskal-Wallis assumes groups and observations are independent; violating this invalidates the test regardless of the shape check.

How to check: Not checked by KernelStats: assumed from the study design; stated directly as a standing reminder.

A worked example

Comparing body mass across three penguin species (151, 68, 123 birds respectively).

Result: H(2) = 217.6, p < .001; epsilon-squared = 0.64; eta-squared-H = 0.64 (closely matching epsilon-squared at this sample size); Dunn's post-hoc (Bonferroni) finds Gentoo different from both Adelie and Chinstrap (p < .001), but Adelie versus Chinstrap is not significant (adjusted p = 1.00; mean ranks differ by under 6).

With a reasonably large sample and only three groups, epsilon-squared and eta-squared-H agree closely, both confirming a large effect, and the post-hoc comparisons show exactly where it lives: Gentoo is heavier than the other two, while Adelie and Chinstrap are indistinguishable in body mass. A significant omnibus test never implies that every pair differs.

From the Statistics Library.

The code tabs

Code gives this analysis as Python, R and MATLAB code (and SAS where the tab offers it), reading the data the way KernelStats did. Export sends the card to a report or to slides. See The Code tab.

Understand the statistics

Ask Oobi

Type one of these into Ask Oobi beside your data:

  • Does body mass differ across the three penguin species?
  • Explain the Kruskal-Wallis test in plain words.
  • What does epsilon-squared mean?

Last reviewed November 16, 2026.

Report an unclear step