43.4
2
9
19.5
9
34.5
6.5
3
11.5
43.4
2
9
19.5
9
34.5
6.5
3
11.5
The Kruskal-Wallis Test Calculator is the non-parametric alternative to one-way ANOVA for comparing three or more independent groups. Instead of comparing means, it compares the rank distributions of the groups, making it suitable for ordinal data or continuous data that violate ANOVA's normality assumption.
Enter values for three groups (up to 3 observations each) to compute the H-statistic, rank sums, and degrees of freedom. The H-statistic approximately follows a chi-square distribution under the null hypothesis.
The Kruskal-Wallis test ranks all observations from all groups combined, then examines whether the rank sums differ more than expected by chance. The procedure is:
The test statistic is:
$$H = \frac{12}{N(N+1)} \sum_{i=1}^{k} \frac{R_i^2}{n_i} - 3(N+1)$$
Where \(N\) is the total sample size, \(k\) is the number of groups, \(n_i\) is the size of group \(i\), and \(R_i\) is the rank sum of group \(i\). Under the null hypothesis that all groups come from the same distribution, H approximately follows a chi-square distribution with \(k - 1\) degrees of freedom.
The expected rank sum for group \(i\) under H₀ is \(n_i(N+1)/2\). The H-statistic measures how much the observed rank sums deviate from these expected values. Larger H indicates greater between-group differences in rank distributions.
A tie correction factor can be applied: \(H_{corrected} = H / (1 - \sum(t^3 - t) / (N^3 - N))\), where \(t\) is the number of tied observations in each tied group.
Interpreting the Kruskal-Wallis test results:
Inputs
Results
Three dosage groups tested. H = 5.6 < 5.991 (critical at α=0.05, df=2), marginally non-significant. Group 3 has the highest rank sum, indicating higher values.
Inputs
Results
Plant heights across three soil types. H = 7.2 > 5.991, indicating significant differences. Post-hoc tests would identify which soil types differ.
Use Kruskal-Wallis when: (1) Data are ordinal (ranked), (2) The normality assumption of ANOVA is violated and samples are small, (3) Group variances are very different (heteroscedasticity), (4) Data contain extreme outliers. For normally distributed data, ANOVA is slightly more powerful. The Kruskal-Wallis test has approximately 95% of the power of ANOVA under normality.
Kruskal-Wallis is the k-group extension of the Mann-Whitney U test. When k = 2 groups, the Kruskal-Wallis H-statistic equals the square of the Mann-Whitney Z-statistic (H = Z²). Both are rank-based non-parametric tests, but Mann-Whitney handles exactly two groups while Kruskal-Wallis handles three or more.
Dunn's test is the most common post-hoc procedure, performing pairwise comparisons using rank sums with a correction for multiple comparisons (Bonferroni or Holm). Alternatively, perform pairwise Mann-Whitney U tests with a Bonferroni-adjusted significance level (α/number of comparisons). The Steel-Dwass-Critchlow-Fligner test is another option that controls familywise error.
Strictly, Kruskal-Wallis tests whether the groups come from the same distribution (stochastic equality). It tests medians only when group distributions have the same shape and spread. If distributions differ in shape, a significant result might reflect differences in spread rather than location. Always examine group distributions alongside the test result.
Under the null hypothesis, H approximately follows a chi-square distribution with k−1 degrees of freedom. This approximation improves with larger sample sizes. For very small samples (each ni < 5), exact tables of the Kruskal-Wallis distribution should be used instead. The approximation is generally adequate when each group has at least 5 observations.
Yes, Kruskal-Wallis naturally accommodates unequal group sizes — the formula adjusts for ni in each term. Unequal sizes are common in non-parametric settings. However, very unequal group sizes reduce power and can make the chi-square approximation less accurate. Balance your design when possible for maximum power.
Roboculator Team
The Roboculator Team explains calculations, planning tools, and practical formulas in clear language for real-life situations.
How helpful was this calculator?
Be the first to rate!
P-Value Calculator
Statistical Inference & Hypothesis Testing
Confidence Interval Calculator
Statistical Inference & Hypothesis Testing
Margin of Error Calculator
Statistical Inference & Hypothesis Testing
Sample Size Calculator
Statistical Inference & Hypothesis Testing
Critical Value Calculator
Statistical Inference & Hypothesis Testing
Z-Test Calculator
Statistical Inference & Hypothesis Testing