Skip to content
Tutorials Center
My learning

Topics

Lesson 27 of 39 ยท Hypothesis Tests

Non-Parametric Tests in SPSS: Mann-Whitney, Wilcoxon, Kruskal-Wallis

Use rank-based tests in SPSS when data are ordinal or skewed: Mann-Whitney U, Wilcoxon signed-rank, Kruskal-Wallis and Friedman, with menus, syntax and reading output.

The t test and ANOVA assume roughly normal scale data. When the outcome is ordinal (satisfaction on a 1-5 scale), strongly skewed, or full of outliers in a small sample, non-parametric tests are the safer choice. They replace each value with its rank and compare the ranks, so extreme values lose their grip.

The four workhorses

Question Parametric Non-parametric SPSS syntax keyword
2 independent groups Independent t Mann-Whitney U /M-W=
2 related measures Paired t Wilcoxon signed-rank /WILCOXON=
3+ independent groups One-way ANOVA Kruskal-Wallis H /K-W=
3+ related measures Repeated-measures ANOVA Friedman /FRIEDMAN=

The price is a bit less power when the data really are normal. In exchange you get validity without the normality assumption.

How ranking works

Sort all values together, give the smallest rank 1, and average the ranks of ties. Mann-Whitney then asks whether one group's ranks tend to be higher than the other's. The statistic U counts how often a value from one group beats a value from the other.

Python Stand-in: ranks, ties and the Mann-Whitney U

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

SPSS output shows exactly these Mean Rank and Sum of Ranks values in its Ranks table.

Mann-Whitney U in SPSS

Two paths exist. The classic one:

  1. Analyze > Nonparametric Tests > Legacy Dialogs > 2 Independent Samples.
  2. Test Variable List: the outcome. Grouping Variable: the group; Define Groups (1 and 2).
  3. Keep Mann-Whitney U ticked. Options: Descriptive and Quartiles are useful.
Text
NPAR TESTS
  /M-W=satisfaction BY group(1 2)
  /MISSING ANALYSIS.

The newer path is Analyze > Nonparametric Tests > Independent Samples, where you choose "Automatically compare distributions across groups" or customize the analysis; it prints a Hypothesis Test Summary and a Model Viewer chart.

Output: Ranks (N, Mean Rank, Sum of Ranks) and Test Statistics (Mann-Whitney U, Wilcoxon W, Z, Asymp. Sig. (2-tailed), and for small samples Exact Sig.). Report U, Z (or the exact p) and an effect size r = |Z| / sqrt(N).

Wilcoxon signed-rank in SPSS

Analyze > Nonparametric Tests > Legacy Dialogs > 2 Related Samples, put pre and post in a pair, keep Wilcoxon.

Text
NPAR TESTS
  /WILCOXON=pre WITH post (PAIRED)
  /MISSING ANALYSIS.

Output: Ranks (Negative Ranks, Positive Ranks, Ties with their N and mean ranks) and Test Statistics (Z, Asymp. Sig.). Pairs with a zero difference are ties and are dropped. Footnotes tell you the direction: "post < pre" means the negative ranks.

Python Stand-in: Wilcoxon signed-rank and Kruskal-Wallis

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Kruskal-Wallis in SPSS

Analyze > Nonparametric Tests > Legacy Dialogs > K Independent Samples, outcome in Test Variable List, group in Grouping Variable, Define Range (minimum 1, maximum 3). Syntax: /K-W=score BY group(1 3). Output: Ranks per group, then Test Statistics with Kruskal-Wallis H, df and Asymp. Sig.

A significant H only says some group differs. For pairwise follow-ups use the newer Independent Samples procedure, which gives pairwise comparisons with adjusted significance, or run Mann-Whitney tests and divide alpha by the number of comparisons (Bonferroni).

Friedman

For 3+ related measures (one person rated under three conditions), use Analyze > Nonparametric Tests > Legacy Dialogs > K Related Samples and keep Friedman. Syntax: /FRIEDMAN=c1 c2 c3.

What are you comparing?

Mann-Whitney does not compare means; strictly it asks whether one group tends to produce larger values (stochastic dominance). If the groups' shapes are similar it is a comparison of medians. Report medians and interquartile ranges, not means, in the text.

Common mistakes

  • Reporting means and SDs for ordinal or skewed data.
  • Reading Z and p from the wrong row (SPSS prints Wilcoxon W too, which for two independent groups is just the rank sum of the smaller group).
  • Running Kruskal-Wallis and stopping without a follow-up when the result is significant and the groups matter individually.
  • Using these tests as a way to "rescue" a non-significant parametric result.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which test replaces the independent-samples t test for ordinal data?

    Mann-Whitney compares the ranks of two independent groups.
  2. 2. What does SPSS do with pairs whose difference is exactly zero in a Wilcoxon test?

    Tied pairs appear in the Ranks table as Ties and contribute no rank sum.
  3. 3. A significant Kruskal-Wallis result tells you:

    The omnibus test needs a follow-up, with adjusted alpha, to locate the differences.
  4. 4. What should you summarise in the text when using these tests?

    Ranks-based tests pair naturally with medians and quartiles.

Summary

  • Rank-based tests suit ordinal, skewed or outlier-ridden data and small samples.
  • Mann-Whitney (2 independent), Wilcoxon (2 related), Kruskal-Wallis (3+ independent), Friedman (3+ related).
  • Menus: Analyze > Nonparametric Tests > Legacy Dialogs (or the newer objective-based dialogs); syntax is NPAR TESTS.
  • Report medians and an effect size, and follow significant omnibus tests with adjusted pairwise comparisons.

Next: One-Way ANOVA