SPSS command: SPSS NPAR TESTS /WILCOXON

Wilcoxon signed-rank test in your browser

The Wilcoxon signed-rank test compares two measurements on the same cases by ranking the size of each paired difference and checking whether positive and negative changes balance out.

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

What it tells you

Crosstabs runs it as SPSS NPAR TESTS /WILCOXON, with the sign test and McNemar's test for paired yes/no outcomes in the same panel.

  • How many cases went up, went down or stayed the same (positive ranks, negative ranks and ties), with mean and summed ranks.
  • Whether the changes lean in one direction more than chance allows: tie-corrected Z with asymptotic and, where available, exact two-tailed significance.
  • The size of the change as r = |Z|/√N, where N counts every analysed pair.
  • For coarse data, whether pluses and minuses balance (sign test), and for two binary variables, whether the share of “yes” changed (McNemar).

When to use it

Use it when

  • Before/after or pre/post measurements on the same people where the differences are skewed or contain outliers.
  • Two ratings given by the same respondent, such as importance and satisfaction on a 1–5 scale.
  • Matched pairs (twins, matched stores) compared on an ordinal outcome.
  • A yes/no item asked twice of the same people: use McNemar to test whether the proportion changed.

Use something else when

  • Two independent groups: use the Mann-Whitney U test.
  • Three or more measurements of the same cases: use the Friedman test or repeated-measures ANOVA.
  • Roughly normal differences and a need for a confidence interval for the mean change: the paired-samples t test is more informative.

How to run it in Crosstabs

  1. 01

    Choose Two related samples

    In Statistics mode open Nonparametric tests → Two related samples (NPAR TESTS /WILCOXON).

  2. 02

    Build the test pairs

    Under Test pairs choose Variable 1 and Variable 2, then click Add pair. Repeat for more pairs. Differences are computed as Variable 2 − Variable 1.

  3. 03

    Choose the tests

    Under Test type tick Wilcoxon (the default), Sign and/or McNemar. McNemar needs exactly two values across both variables, such as 0/1.

  4. 04

    Set missing values and run

    Exclude cases test-by-test drops a case only from pairs where it is missing; Exclude cases listwise drops it from every pair. Click Run test.

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

16 synthetic users with weekly active minutes measured before and after a feature launch. Baseline usage is log-normal and each user's change is a random multiplicative shift, so differences are skewed.

Ranks — Wilcoxon Signed Ranks Test
after - beforeNMean RankSum of Ranks
Negative Ranks47.5030.00
Positive Ranks128.83106.00
Ties0
Total16

Negative ranks: after < before. Positive ranks: after > before.

Test Statistics — Wilcoxon Signed Ranks Test
Itemafter - before
Z−1.965
Asymp. Sig. (2-tailed).049
Exact Sig. (2-tailed).051
Effect size r = |Z|/√N0.491

Based on negative ranks.

How to read it

12 of 16 users used the product more after the launch and 4 used it less. The positive ranks sum to 106.0 against 30.0 for the negative ranks, giving Z = −1.96, exact p = .051 and r = 0.49. The asymptotic p (.049) falls on the other side of .05; with only 16 pairs, report the exact value.

Output tables explained

Ranks — Wilcoxon Signed Ranks Test
Negative ranks (second < first), positive ranks (second > first) and ties, each with N, mean rank and sum of ranks.
Test Statistics — Wilcoxon Signed Ranks Test
Z (based on the smaller rank sum), asymptotic and exact two-tailed significance and r = |Z|/√N. The exact value appears when there are no tied absolute differences and at most 50 non-zero differences.
Test Statistics — Sign Test
Counts of negative and positive differences and ties (in Frequencies — Sign Test), with an exact binomial significance for up to 25 non-tied pairs and a continuity-corrected Z above that.
Test Statistics — McNemar Test
N, chi-square and significance for the paired 2 × 2 table shown above it; exact binomial for up to 25 discordant pairs, continuity-corrected chi-square otherwise.

Assumptions and notes

  • Pairs are independent of each other, and both values in a pair belong to the same case or matched unit.
  • Differences can be ordered by size; the signed-rank test also assumes they are roughly symmetric around their median. If not, use the sign test.
  • Zero differences are dropped from the ranking but still counted as ties and in N for r.

How the results are validated

The paired 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: Wilcoxon statistics, Z and exact and asymptotic p-values match scipy.stats.wilcoxon, the sign test matches scipy.stats.binomtest for up to 25 pairs and the SPSS normal formula above, and McNemar matches statsmodels mcnemar in exact and continuity-corrected forms, all within 1e-9 (relative to the larger of 1 and the reference value). Validation evidence

Questions

Which direction is a positive rank?

Differences are Variable 2 − Variable 1, so a positive rank means the second variable is higher. Put the “before” measure as Variable 1 to read positive ranks as increases.

Why is there no exact p value in my output?

The exact signed-rank distribution is used only when no absolute differences are tied and there are at most 50 non-zero differences. Otherwise the tie-corrected asymptotic value is the one to report.

When should I use the sign test instead?

When only the direction of change is trustworthy, for example coarse ratings where a 1-point and a 3-point change should not be weighted differently, or when the differences are clearly asymmetric.

Can McNemar handle answers coded 1/2 instead of 0/1?

Yes. Any two codes work as long as exactly two distinct values appear across both variables; value labels are used for the 2 × 2 table.

Run Wilcoxon Signed-Rank 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.