# Kruskal-Wallis Test Calculator

Perform the Kruskal-Wallis H test for 2-4 independent groups. Get the H statistic, degrees of freedom, and p-value without assuming normality.

## What this calculates

Enter data for 2 to 4 independent groups to perform the Kruskal-Wallis H test, the non-parametric alternative to one-way ANOVA. No normality assumption required.

## Inputs

- **Group 1 Values** — Comma-separated values for group 1.
- **Group 2 Values** — Comma-separated values for group 2.
- **Group 3 Values** — Comma-separated values for group 3 (optional, leave empty to skip).
- **Group 4 Values** — Comma-separated values for group 4 (optional, leave empty to skip).

## Outputs

- **H Statistic** — The Kruskal-Wallis test statistic.
- **Degrees of Freedom** — Number of groups minus 1.
- **Approximate P-Value** — P-value from chi-square approximation.
- **Significant at α = 0.05?** — formatted as text — Whether the result is statistically significant.
- **Group Summary** — formatted as text — Sample sizes and mean ranks for each group.
- **Calculation** — formatted as text — Step-by-step H statistic computation.

## Details

**What is the Kruskal-Wallis Test?**

The Kruskal-Wallis test is a rank-based non-parametric test for comparing distributions across two or more independent groups. It extends the Mann-Whitney U test to more than two groups and is the non-parametric counterpart to one-way ANOVA.

**Formula:**

**H = (12 / (N(N+1))) x Σ(Rj²/nj) - 3(N+1)**

Where N = total observations, Rj = sum of ranks in group j, nj = size of group j.

**How it works:**

1. Combine all groups and rank all values together
2. Handle ties by assigning the average rank
3. Sum the ranks within each group
4. Compute H from the rank sums
5. Compare H to a chi-square distribution with (k-1) degrees of freedom

**When to use Kruskal-Wallis:**

- Your data does not meet ANOVA's normality assumption
- You have ordinal data or ranked data
- Sample sizes are small or unequal
- Your data has outliers that would distort parametric tests

If H is significant, use post-hoc pairwise Mann-Whitney tests (with a Bonferroni correction) to find which groups differ.

## Frequently Asked Questions

**Q: How is Kruskal-Wallis different from one-way ANOVA?**

A: One-way ANOVA assumes the data in each group is normally distributed and tests for differences in means. Kruskal-Wallis makes no normality assumption. It ranks all observations together and tests whether the rank distributions differ across groups. Use Kruskal-Wallis when your data is ordinal, heavily skewed, or has small samples where normality is hard to verify.

**Q: What should I do if the Kruskal-Wallis test is significant?**

A: A significant result tells you that at least one group differs from the others, but not which one. Follow up with pairwise Mann-Whitney U tests (or Dunn's test) using a Bonferroni correction to control for multiple comparisons and identify the specific group differences.

**Q: Does the Kruskal-Wallis test handle ties?**

A: Yes, ties are handled by assigning the average rank to all tied observations. For example, if three values tie for positions 4, 5, and 6, each gets rank 5. With many ties, a tie-correction factor can be applied to H, but the effect is usually small.

---

Source: https://vastcalc.com/calculators/statistics/kruskal-wallis
Category: Statistics
Last updated: 2026-04-08
