SPSS command: SPSS NPAR TESTS /M-W

Mann-Whitney U test in your browser

The Mann-Whitney U test compares two independent groups by ranking all values together and asking whether one group tends to sit higher.

Free · No account · Files stay on your device · Updated 18 October 2026

What it tells you

Crosstabs runs it as SPSS NPAR TESTS /M-W does, with the tie-corrected Z, an exact significance for small samples and the effect size r = |Z|/√N, alongside three other two-sample tests.

  • Which group tends to have higher values, from the mean rank and sum of ranks of each group.
  • Whether that difference is larger than chance: U, Wilcoxon W, Z and asymptotic and exact two-tailed significance.
  • How big the difference is, as r = |Z|/√N (about .1 small, .3 medium, .5 large).
  • Whether the two distributions differ in any way (two-sample Kolmogorov-Smirnov Z), whether one group shows extreme reactions in both directions (Moses), and whether the groups interleave randomly (Wald-Wolfowitz runs).

When to use it

Use it when

  • Two independent groups compared on an ordinal rating (1–5 or 1–10 scales) where means are hard to defend.
  • A skewed scale outcome (spend, time on task, counts) with small groups or obvious outliers.
  • An A/B test with two variants where you want a result that does not depend on normality.

Use something else when

  • The same people measured twice: use the Wilcoxon signed-rank test for paired data.
  • Three or more groups: use the Kruskal-Wallis test, which adds Dunn pairwise comparisons.
  • Roughly normal data with a need for a confidence interval for the mean difference: the independent-samples t test is more informative.

How to run it in Crosstabs

  1. 01

    Choose Two independent samples

    In Statistics mode open Nonparametric tests → Two independent samples (NPAR TESTS /M-W).

  2. 02

    Tick the test variables

    Under Test variables tick one or more numeric outcomes. Each outcome is tested separately.

  3. 03

    Define the two groups

    Pick the Grouping variable (2–50 distinct values), then choose the values for Group 1 and Group 2. Cases in other groups are ignored.

  4. 04

    Choose the test type

    Mann-Whitney U is ticked by default; add Kolmogorov-Smirnov Z, Moses extreme reactions (Group 1 is the control group) or Wald-Wolfowitz runs as needed.

  5. 05

    Set missing values and run

    Choose Exclude cases test-by-test or Exclude cases listwise and click Run test. Declare a workspace weight as a frequency weight to replicate cases.

Worked example

Computed by the Crosstabs engine from the synthetic data below when this page was built — not typed in.

Try with example data

Data

24 synthetic users rate an onboarding flow from 1 to 10: 11 saw variant A and 13 saw variant B. Ratings are rounded draws from two normal curves with different centres, so the data contain many tied values, as real rating scales do.

Ranks
variantNMean RankSum of Ranks
A117.0577.50
B1317.12222.50
Total24
Test Statistics — Mann-Whitney U
Itemscore
Mann-Whitney U11.5
Wilcoxon W77.5
Z−3.521
Asymp. Sig. (2-tailed)<.001
Exact Sig. [2*(1-tailed Sig.)]<.001ᵇ
Effect size r = |Z|/√N0.719

Grouping variable: variant. b. Not corrected for ties. Z is corrected for ties.

How to read it

Variant B has the higher mean rank (B 17.12, A 7.05). U = 11.5, Z = −3.52, exact p < .001, with r = 0.72 (a large effect by Cohen's benchmarks). The ratings are heavily tied, so also check the tie-corrected asymptotic p (<.001): the exact value ignores ties.

Output tables explained

Ranks
N, mean rank and sum of ranks for each group. The group with the higher mean rank tends to have higher values.
Test Statistics — Mann-Whitney U
U, Wilcoxon W, tie-corrected Z, asymptotic two-tailed significance, the exact significance [2*(1-tailed Sig.)] when n₁·n₂ ≤ 400 and n₁·n₂/2 + min(n₁, n₂) ≤ 220, and r = |Z|/√N.
Test Statistics — Two-Sample Kolmogorov-Smirnov Test
The most extreme absolute, positive and negative differences between the two cumulative distributions, Kolmogorov-Smirnov Z and its asymptotic significance.
Test Statistics — Moses Test
The span of the control group (Group 1) among the pooled ranks, observed and after trimming outliers from each end, each with a one-tailed significance.
Test Statistics — Wald-Wolfowitz Test
Number of runs, Z and one-tailed significance (exact up to 30 cases). Ties between groups give a minimum and a maximum possible number of runs.

Assumptions and notes

  • The two groups are independent and each case belongs to one group.
  • The outcome is at least ordinal. To read the result as a difference in medians, the two distributions should have a similar shape.
  • The exact significance ignores ties; with many tied ratings, compare it with the tie-corrected asymptotic value.

How the results are validated

The two-sample engines are tested against independent reference values computed with SciPy 1.18.1, statsmodels 0.15.0, pingouin 0.7.0 and scikit-posthocs 0.17.1. Mann-Whitney U and its exact and asymptotic p-values match scipy.stats.mannwhitneyu (no continuity correction) within 1e-9, |Z| within 1e-7; the two-sample K-S statistic matches scipy.stats.ks_2samp, with the Smirnov asymptotic p held to 2e-6; Moses and Wald-Wolfowitz significance are checked against enumeration of every arrangement of the pooled sample. Validation evidence

Questions

Does the Mann-Whitney test compare medians?

Strictly it tests whether a value from one group tends to exceed a value from the other. It becomes a test of medians only when both groups have the same distribution shape, so report mean ranks and describe medians separately.

Which p value should I report, exact or asymptotic?

With small groups and few ties, report the exact significance. With many ties, prefer the asymptotic value, because its Z is corrected for ties and the exact value is not.

Why are U and W both shown?

They are equivalent: W is the rank sum of one group and U = W − n(n + 1)/2 for that group. SPSS reports the smaller U, and Crosstabs follows that convention.

When is the Kolmogorov-Smirnov Z test a better choice?

When the groups may differ in spread or shape rather than location. It reacts to any difference between the cumulative distributions, but has less power than Mann-Whitney for a pure shift.

Can I use a string variable such as "control"/"treatment" as the grouping variable?

Yes. Any variable with 2–50 distinct non-missing values can be the grouping variable; only the test variables must be numeric.

Run Mann-Whitney U Test on your own data

Open a .sav, CSV or Excel file. Everything runs in your browser; the file never leaves your device.

Open the workspace

SPSS is a trademark of IBM Corp. Crosstabs is not affiliated with or endorsed by IBM.