Kruskal-Wallis Test Calculator
Perform the Kruskal-Wallis H test , a nonparametric alternative to one-way ANOVA for comparing three or more independent groups. This calculator ranks all observations, computes the H statistic, determines the p-value using the chi-square distribution, and compares it to the critical value.
What Is the Kruskal-Wallis Test?
The Kruskal-Wallis test (also known as the H test) is a nonparametric statistical test used to determine whether three or more independent groups have the same population median. It is the nonparametric equivalent of the one-way ANOVA and does not require the assumption of normality or equal variances.
Null Hypothesis (H₀): All groups have the same population distribution (equal medians).
Alternative Hypothesis (H₁): At least one group differs from the others in central tendency.
How the Test Works
- Rank All Data: Combine all observations from all groups and rank them from smallest to largest (ignoring group membership). Ties receive the average rank.
- Calculate Rank Sums: Sum the ranks for each group (Rᵢ).
- Compute H Statistic: Use the formula: H = [12 / (N(N+1))] × Σ(Rᵢ² / nᵢ) − 3(N+1), where N is the total number of observations, nᵢ is the size of group i, and Rᵢ is the sum of ranks for group i.
- Tie Correction: If there are ties, H is divided by: 1 − Σ(t³ − t) / (N³ − N), where t is the number of observations in each tied group.
- Determine Significance: H approximately follows a chi-square distribution with k − 1 degrees of freedom. Compare the p-value to your significance level (α).
When to Use the Kruskal-Wallis Test
- When comparing three or more independent groups.
- When the data is ordinal or not normally distributed.
- When there are outliers that would distort ANOVA results.
- When sample sizes are small and normality cannot be assumed.
Why Use This Calculator?
- Complete Analysis: Get H statistic, p-value, degrees of freedom, and critical value comparison.
- Rank Table: See the ranks assigned to each observation and the sum of ranks per group.
- Step-by-Step: Follow the calculation process with detailed steps.
- Visual Chart: Compare mean ranks across groups with an interactive chart.
- Free & Private: No registration, no data storage.
❓ Kruskal-Wallis Test Calculator FAQ
What is the Kruskal-Wallis test?
The Kruskal-Wallis test is a nonparametric statistical test used to compare the medians of three or more independent groups. It is the nonparametric alternative to one-way ANOVA.
What is the null hypothesis of the Kruskal-Wallis test?
The null hypothesis (H₀) states that all groups come from the same population distribution and have equal medians. The alternative hypothesis (H₁) states that at least one group differs from the others.
How is the H statistic calculated?
H = [12 / (N(N+1))] × Σ(Rᵢ² / nᵢ) − 3(N+1), where N is the total number of observations, nᵢ is the group size, and Rᵢ is the sum of ranks for group i.
What are the degrees of freedom for the Kruskal-Wallis test?
The degrees of freedom are k − 1, where k is the number of groups.
How do I interpret the p-value?
If the p-value is less than your significance level (α), you reject the null hypothesis and conclude that at least one group differs from the others. If the p-value is greater than α, you fail to reject the null hypothesis.
What is the tie correction?
When there are ties in the data, the H statistic is corrected by dividing by: 1 − Σ(t³ − t) / (N³ − N), where t is the number of observations in each tied group.
How many groups can I compare?
You can compare three or more independent groups. For exactly two groups, the Mann-Whitney U test is typically used.
Is this calculator free?
Yes, this calculator is completely free to use. No registration or personal data storage is required. All calculations are performed in your browser.