DigitHelm
Statistics & Probability

Kruskal-Wallis H Test Calculator | Non-Parametric One-Way ANOVA

Perform the Kruskal-Wallis H test across 2–6 independent groups as a non-parametric alternative to one-way ANOVA. Computes the H statistic, degrees of freedom, chi-square p-value, and pairwise Dunn post-hoc comparisons with Bonferroni correction.

Instant Results100% FreeAny DeviceNo Sign-up

What Is the Kruskal-Wallis H Test Calculator | Non-Parametric One-Way ANOVA?

The Kruskal-Wallis H test is the non-parametric analogue of one-way ANOVA. It tests whether k independent groups come from the same population distribution using ranks. All observations are pooled and ranked together; H measures how much the mean ranks of the groups deviate from what we'd expect under the null hypothesis.

H follows an approximate χ² distribution with k−1 degrees of freedom for groups of 5 or more (or exact tables for smaller groups). When H is significant, the Dunn post-hoc test with Bonferroni correction identifies which specific pairs of groups differ significantly.

Formula

H = (12/(N(N+1))) · Σ(Rᵢ²/nᵢ) − 3(N+1)  |  df = k−1

Tie correction: H_c = H / (1 − Σ(t³−t)/(N³−N))

p-value from χ²(df) distribution

Effect size: η² = (H − k + 1)/(N − k)  |  Dunn z = |R̄ᵢ − R̄ⱼ| / √[(N(N+1)/12)(1/nᵢ+1/nⱼ)]

How to Use

  1. 1

    Select the number of groups (2–6) using the dropdown at the top.

  2. 2

    Enter values for each group in the corresponding textarea (comma or newline separated).

  3. 3

    Each group needs at least 2 values; 5 or more per group gives more reliable χ² approximation.

  4. 4

    Click Run H Test to compute the Kruskal-Wallis statistic.

  5. 5

    Read H (corrected for ties), degrees of freedom, and p-value from the summary cards.

  6. 6

    Review the Group Summary table to compare mean ranks across groups.

  7. 7

    For k > 2, check the Dunn Post-hoc table for pairwise comparisons with Bonferroni correction.

Select the number of groups (2–6), enter values for each group, then click Run H Test. Post-hoc Dunn comparisons appear automatically when k > 2.

Example Calculation

Example 1 — Three teaching methods (n=5 each): Group 1: 12,15,18,14,16. Group 2: 20,22,25,21,23. Group 3: 10,11,13,12,14. After pooling 15 values and ranking, mean ranks are R̄₁=7.6, R̄₂=13.0, R̄₃=3.4. H = 12/(15·16)·(5·7.6²+5·13²+5·3.4²)−48 ≈ 11.1, p ≈ 0.004. Dunn test shows Group 2 vs Group 3 is significant after Bonferroni.

Example 2 — Two groups (equivalent to Mann-Whitney): With k=2, the Kruskal-Wallis test is mathematically equivalent to the Mann-Whitney U test. H = z² and p-values match within rounding. Use Mann-Whitney for two groups as it also provides effect size r and the U statistic.

Understanding Kruskal-Wallis H Test | Non-Parametric One-Way ANOVA

Kruskal-Wallis vs One-Way ANOVA

PropertyKruskal-WallisOne-Way ANOVA
DistributionNon-parametric (rank-based)Parametric (assumes normality)
Data typeOrdinal or continuousContinuous
Test statisticH (chi-squared approx.)F statistic
Effect sizeη² from Hη² from SS ratio
Post-hoc testDunn + BonferroniTukey HSD, Scheffé
Sensitivity to outliersResistantSensitive
Relative power (normal data)~95.5% of ANOVA100% baseline

η² Effect Size Benchmarks

η² valueClassificationMeaning
< 0.01NegligibleGroup membership explains very little rank variability
0.01 – 0.06SmallDetectable effect; modest practical importance
0.06 – 0.14MediumMeaningful group differences; practically relevant
> 0.14LargeStrong effect; clearly different group distributions

Post-hoc Testing Guidance

  • Only run post-hoc tests after a significant overall H — running them on a non-significant H increases false discovery rate.
  • Bonferroni correction is conservative; with 6 groups (15 pairs) the adjusted α per test is 0.05/15 = 0.0033.
  • Dunn test compares mean ranks, not raw medians — interpretations should reference ranks or relative ordering.
  • For unequal group sizes the Dunn z formula automatically adjusts: larger groups reduce standard error.
  • Report both raw and Bonferroni-adjusted p-values so readers can apply alternative corrections (e.g., Holm).
  • Pairwise comparisons after a significant H are exploratory, not confirmatory — treat results as hypothesis-generating.

Frequently Asked Questions

When should I use Kruskal-Wallis instead of one-way ANOVA?

Use Kruskal-Wallis when your data violates ANOVA's normality assumption, when you have ordinal data, or when sample sizes are small and unequal across groups. ANOVA is more powerful when normality holds. Both tests have similar power for large samples from non-normal distributions (Kruskal-Wallis retains ~95.5% of ANOVA efficiency).

What does a significant H tell me?

A significant H (p < 0.05) indicates that at least one group has a different central tendency (location) compared to at least one other group — but it does not say which pairs differ. You need the Dunn post-hoc test (or another pairwise method) to identify which specific groups differ. Always follow up a significant H with pairwise comparisons.

What is the Bonferroni correction in the Dunn test?

Each pairwise Dunn test is a z-test between group mean ranks. Without correction, running k(k−1)/2 tests inflates the family-wise error rate. Bonferroni correction multiplies each raw p-value by the number of comparisons k(k−1)/2, capping at 1. It is conservative (especially for many groups) but widely accepted for its simplicity.

What is η² (eta-squared) effect size for Kruskal-Wallis?

η² = (H − k + 1)/(N − k) estimates the proportion of variance in ranks explained by group membership. Benchmarks: η² < 0.01 = negligible; 0.01–0.06 = small; 0.06–0.14 = medium; > 0.14 = large (Cohen, 1988). It is analogous to R² in ANOVA but applies to the rank-transformed data.

How does the tie correction work?

Ties reduce the variability of ranks, which inflates H. The correction divides H by (1 − Σ(t³−t)/(N³−N)) where t is the size of each tie group. For data with few ties, the correction has minimal effect. With many ties (e.g., Likert scale data with many identical values), the correction can meaningfully increase the corrected H.

You Might Also Like

Explore 360+ Free Calculators

From math and science to finance and everyday life — all free, no account needed.