Unit 9 · Same people, several times

How to run a Wilcoxon signed-rank test in SPSS

Run a Wilcoxon signed-rank test in SPSS for related samples, read the ranks and report z, p, medians and effect size r.

Free tutorialPro practiceAbout 5 minutes6 practice questions

Quick answer: How do you run a Wilcoxon signed-rank test in SPSS?

  1. Click Analyze › Nonparametric Tests › Legacy Dialogs › 2 Related Samples.
  2. Move the two related variables into the same pair.
  3. Keep Wilcoxon ticked and click OK.

Report it in APA style: Pain fell from before (Mdn = 6) to after treatment (Mdn = 4), z = −2.87, p = .004, r = .64.

Last updated November 2026 · Not sure this is the right test? Try the Which statistical test? tool.

What is the Wilcoxon signed-rank test?

The Wilcoxon signed-rank test is the non-parametric alternative to the paired t-test. It compares two related measurements, such as pain before and after treatment, using the ranks of the differences.

When to use it

  • Two related measurements from the same people (or matched pairs).
  • Ordinal data, or difference scores that are clearly non-normal.

How it works

SPSS works out each person’s difference, drops zero differences (ties), ranks the rest by size ignoring the sign, then compares the total of the positive ranks with the total of the negative ranks. If there were no real change, the two totals would be similar. The result is given as z, and r = |z| ÷ √N is a common effect size.

Assumptions

  • Paired observations.
  • Ordinal or Scale outcome.
  • Differences roughly symmetrical around the median.

Worked example

Pain fell from Mdn = 6 to Mdn = 4 after treatment, z = −2.87, p = .004, r = .64. 15 of 20 patients improved.

Key terms

Signed rank
A difference’s rank, given the sign of the difference.
Ties
Pairs with no change; excluded from the test.

Common mistakes

  • Using Mann-Whitney for paired data.
  • Reporting means instead of medians.

How to do it in SPSS

Wilcoxon signed-rank test

The nonparametric version of the paired t-test. Use it for before-and-after ratings or skewed difference scores.

Two-Related-Samples Tests
Variables
Participant ID [id]
Pain before [pain_pre]
Pain after [pain_post]
Test Pairs:1
PairVariable1Variable2
1pain_prepain_post
Test Type2
✓Wilcoxon
Sign
McNemar
Marginal Homogeneity
Exact…Options…3
OKPasteResetCancelHelp
  1. 1
    Test PairsEach row is one before-and-after pair. SPSS works out Variable2 − Variable1.
  2. 2
    WilcoxonTicked by default. Found under Analyze › Nonparametric Tests › Legacy Dialogs › 2 Related Samples.
  3. 3
    Options…Tick Quartiles to get the medians you’ll report.

Reading Wilcoxon output

The Ranks table tells you the direction; the Test Statistics table tells you whether it’s significant.

Output1 [Document1] – SPSS Statistics Viewer
FileEditViewDataTransformAnalyzeGraphsUtilitiesExtensionsWindowHelp
Output
Log
NPar Tests
Wilcoxon Signed Ranks Test
Ranks
Test Statistics
Ranks · pain_post − pain_pre
NMean RankSum of Ranks
Negative Ranks115a10.10151.50
Positive Ranks3b6.5019.50
Ties22c
Total20

a. pain_post < pain_pre · b. pain_post > pain_pre · c. pain_post = pain_pre

Test Statistics
pain_post − pain_pre
Z−2.87b3
Asymp. Sig. (2-tailed).0044

b. Based on positive ranks. Medians: before = 6, after = 4

  1. 1
    Negative RanksPeople whose score went down (after < before). 15 of 20 people reported less pain.
  2. 2
    TiesPeople whose score didn’t change. They’re left out of the test.
  3. 3
    ZThe test statistic to report. Effect size r = |Z| ÷ √N = 2.87 ÷ √20 = .64.
  4. 4
    Asymp. Sig..004 is below .05, so pain changed significantly.

Report medians, not means: pain fell from Mdn = 6 to Mdn = 4.

The SPSS syntax

Prefer typing to clicking? Open File › New › Syntax, paste this in, select it and choose Run › Selection. Every dialog's Paste button writes the same kind of code.

NPAR TESTS
  /WILCOXON=pain_pre WITH pain_post (PAIRED)
  /STATISTICS QUARTILES.

Practice data

Download the file used in this lesson and run it yourself in SPSS: you should get the same results as the screens above.

  • pain.savPain ratings before and after treatment (N = 20)

Now practise it interactively →

Reading is only half of it. Tap through the real SPSS menus, read the output and pick the right write-up in 6 quick questions, with instant feedback on every answer.

Practice for this lesson is part of Pro, with every unit, unlimited hearts and saved progress.

More in Same people, several times