Kruskal–Wallis H Test in SPSS: How to Run and Interpret It
If you have three or more independent groups and your data does not meet the assumptions of a one-way ANOVA, the Kruskal–Wallis H test is the nonparametric test you reach for. It compares the distributions of the groups without assuming normality, and it is one of the most commonly requested tests in thesis and dissertation work — especially when Likert-scale scores, skewed measures, or small samples make ANOVA a poor fit.
In this tutorial you will learn when to use the Kruskal–Wallis test, how to run it click by click in SPSS, how to read every part of the output, how to follow up a significant result with pairwise comparisons, and how to report it in APA style (7th edition).
When to Use the Kruskal–Wallis Test
Use the Kruskal–Wallis H test when all of the following are true:
- Your dependent variable is ordinal, or continuous but not normally distributed within groups.
- Your independent variable has three or more independent groups (for example, three teaching methods, four treatment conditions, or five departments).
- Observations are independent — each participant belongs to exactly one group.
- The shapes of the distributions are roughly similar across groups if you want to interpret the result as a difference in medians. If the shapes differ a lot, the test still works, but strictly it tests whether the distributions differ, not only whether the medians differ.
If you have only two groups, use the Mann–Whitney U test instead. If your data are normally distributed with roughly equal variances, a one-way ANOVA is more powerful and is usually the better choice.
A classic example: a researcher compares job satisfaction scores (measured on a 1–10 scale) across employees in three departments — Sales, Marketing, and Operations. The scores are skewed, so instead of ANOVA, the Kruskal–Wallis test compares the rank distributions across the three departments.
Hypotheses
- Null hypothesis (H0): The distributions of the dependent variable are the same across all groups.
- Alternative hypothesis (H1): At least one group’s distribution differs from the others.
Note what the test does not tell you: a significant result does not say which groups differ from each other. For that, you need post-hoc pairwise comparisons, covered later in this tutorial.
How the Test Works (in Plain English)
The Kruskal–Wallis test works with ranks rather than raw scores. SPSS pools all the observations together, ranks them from smallest to largest, and then compares the average rank of each group. If the groups truly come from the same population, their average ranks should be similar. If one group consistently scores higher or lower, its average rank will stand out, and the test statistic (H) will be large.
The H statistic approximately follows a chi-square distribution, which is why SPSS reports it alongside a chi-square value and degrees of freedom equal to the number of groups minus one.
Step-by-Step: Running the Kruskal–Wallis Test in SPSS
Step 1: Set Up Your Data
Your data file needs two variables:
- A grouping variable (for example, Department), coded with numbers: 1 = Sales, 2 = Marketing, 3 = Operations. Make sure the values are defined in Variable View under Values.
- A dependent variable (for example, Satisfaction), containing the scores you want to compare.
Each row is one participant, with their group code and their score.
Step 2: Open the Test Dialog
Go to Analyze > Nonparametric Tests > Legacy Dialogs > K Independent Samples.
Step 3: Move the Variables
- Move your dependent variable (Satisfaction) into the Test Variable List box.
- Move your grouping variable (Department) into the Grouping Variable box.
- Click Define Range, enter the Minimum (1) and Maximum (3) group codes, and click Continue.
Step 4: Choose the Test and Options
- Make sure Kruskal-Wallis H is checked (it is the default in this dialog).
- Click Options if you want descriptive statistics and quartiles for each group — this is helpful for reporting medians. Click Continue.
- Click OK to run the test.
SPSS Syntax (Paste-Ready)
If you prefer syntax, or you want a reproducible record of exactly what you ran, paste the following into a new syntax window (File > New > Syntax) and run it. Replace the variable names with your own:
NPAR TESTS /K-W=Satisfaction BY Department(1 3) /STATISTICS DESCRIPTIVES QUARTILES /MISSING ANALYSIS.
The K-W subcommand runs the Kruskal–Wallis test, the BY part names the grouping variable and its range, and the STATISTICS subcommand adds descriptives and quartiles to the output.
How to Interpret the SPSS Output
The Ranks Table
The first table shows, for each group, the sample size (N) and the Mean Rank. The mean rank is the key descriptive here: groups with higher scores get higher mean ranks. If the mean ranks look very different across groups, that is an early sign of a significant result. Also note the medians if you requested quartiles — medians are the natural descriptive to report alongside this test.
The Test Statistics Table
The second table reports:
- Kruskal-Wallis H (labelled Chi-Square in SPSS): the test statistic.
- df: degrees of freedom, equal to the number of groups minus one (for three groups, df = 2).
- Asymp. Sig.: the p-value. If it is below your alpha level (usually .05), reject the null hypothesis.
Worked interpretation: suppose H(2) = 9.84, p = .007. You would conclude that job satisfaction differs significantly across the three departments. The p-value tells you that at least one department differs — it does not tell you which ones.
Effect Size
SPSS does not print an effect size for this test by default, but you can compute eta-squared from the output with a simple formula:
eta-squared = (H − k + 1) / (n − k)
where H is the test statistic, k is the number of groups, and n is the total sample size. Values around .01 are small, around .06 are medium, and around .14 or above are large. Reporting an effect size is good practice because a p-value alone says nothing about how big the difference is.
Post-Hoc Tests: Finding Which Groups Differ
A significant Kruskal–Wallis result must be followed up. There are two common routes in SPSS:
Option 1: The Modern Dialog (Recommended)
Go to Analyze > Nonparametric Tests > Independent Samples. Move your dependent variable into Test Fields and your grouping variable into Groups, then on the Settings tab choose “Customize tests” and select “Kruskal-Wallis 1-way ANOVA (k samples)”. Click Run. In the output, double-click the Model Viewer table and open the Pairwise Comparisons view — SPSS performs Dunn’s pairwise tests with a Bonferroni correction and shows exactly which pairs differ significantly.
Option 2: Manual Mann–Whitney Follow-Ups
Run a Mann–Whitney U test for each pair of groups (Analyze > Nonparametric Tests > Legacy Dialogs > 2 Independent Samples) and apply a Bonferroni correction yourself: divide your alpha level by the number of comparisons. With three groups there are three pairwise comparisons, so the corrected alpha is .05 / 3 = .017. Only pairs with p below .017 count as significant.
Always report which correction you used — uncorrected pairwise tests after a significant Kruskal–Wallis result inflate the risk of false positives.
Common Mistakes to Avoid
- Running a one-way ANOVA on clearly non-normal data just because it is more familiar. If the normality assumption is badly violated, the Kruskal–Wallis test is the honest choice.
- Reporting group means instead of medians or mean ranks. With skewed data, means can mislead; medians describe the typical score better.
- Stopping at a significant overall test without pairwise comparisons. “Groups differ” is an incomplete answer — your readers need to know which groups differ.
- Using the test on related samples. If the same participants were measured in every condition, you need the Friedman test, not Kruskal–Wallis.
- Ignoring distribution shape. If one group is strongly bimodal and another is not, describe the distributions rather than claiming a simple median difference.
Reporting in APA Style (7th ed.)
Report the test statistic (H), degrees of freedom, p-value, effect size, and the medians (or mean ranks) for each group. Name the post-hoc procedure and correction.
Example paragraph (adapt the numbers to your own output):
“A Kruskal–Wallis H test showed a statistically significant difference in job satisfaction across departments, H(2) = 9.84, p = .007, η² = .11. Median satisfaction scores were 7.0 for Sales, 5.0 for Marketing, and 6.0 for Operations. Dunn’s pairwise tests with a Bonferroni correction showed that satisfaction was significantly higher in Sales than in Marketing (p = .004), but no other pairwise differences were significant.”
If the result is not significant, report it just as clearly: “A Kruskal–Wallis H test showed no significant difference in job satisfaction across departments, H(2) = 2.31, p = .315.”
Key Takeaways
- The Kruskal–Wallis H test compares three or more independent groups when ANOVA assumptions fail.
- It works on ranks, so it handles ordinal data and skewed distributions well.
- In SPSS: Analyze > Nonparametric Tests > Legacy Dialogs > K Independent Samples.
- A significant result means at least one group differs — always follow up with pairwise comparisons and a correction such as Bonferroni.
- Report H, df, p, an effect size, and group medians in APA style.
FAQs
When should I use Kruskal–Wallis instead of one-way ANOVA?
Use Kruskal–Wallis when your dependent variable is ordinal or when it is continuous but clearly non-normal within groups, or when variances are very unequal and transformations do not help. If the data are approximately normal with similar variances, ANOVA has more statistical power.
What is the difference between Kruskal–Wallis and Mann–Whitney U?
Mann–Whitney U compares two independent groups; Kruskal–Wallis extends the same rank-based logic to three or more groups. In fact, with exactly two groups, the two tests give equivalent results.
Can I use the Kruskal–Wallis test with Likert-scale data?
Yes — this is one of its most common uses. Likert items and summed Likert scales are ordinal in nature, and the rank-based approach suits them well, especially when responses pile up at one end of the scale.
What do I do if the Kruskal–Wallis test is significant?
Run pairwise comparisons (Dunn’s test with a Bonferroni correction in the modern SPSS dialog, or Mann–Whitney U tests with a corrected alpha) to find which groups differ, and report those results alongside the overall test.
Does the Kruskal–Wallis test compare medians?
Only when the distributions have similar shapes. Strictly, it tests whether the distributions differ. In practice, when shapes are similar, researchers interpret and report it as a difference in medians — so check and describe the distributions before making that claim.
Need this done on your data? Get a free quote →