Stats for

Nonparametric Group Comparisons

Wilcoxon Signed-Rank Test

The Wilcoxon signed-rank test compares two ranked measurements from the same people.

A Wilcoxon signed-rank test takes an ordinal or skewed outcome measured twice in the same people and tests whether their changes lean up or down more than chance would allow.

Example

Does a brisk walk take the edge off smokers' cravings? Thirty smokers rated their urge to smoke from 0 to 10 twice, on different days in random order, once after 15 minutes of brisk walking and once after 15 minutes of sitting quietly.

Same People, Two Conditions + Ordinal Outcome → Wilcoxon Signed-Rank Test
Tests
Center of the difference scores (their median, if symmetric)
Observations
Related
Parametric
No
Headline Statistic
T_+
Effect Size
Matched-Pairs Rank-Biserial r_{rb}
Groups
2

The Basics

When to Use It

Use it when the same people are measured twice on an ordinal or skewed outcome, such as a rating scale, and you want to know whether scores tend to go up or down. It works on the size and direction of each person's change, so it suits ratings, and changes with a few extreme values, where an average would mislead. Skewed scores are fine; what matters is the shape of the changes (see Symmetric Differences). Unlike the sign test, it has to rank the sizes of people's changes, not just tell whether each person went up or down; on an ordinal scale, that means treating the sizes of score differences as comparable. The scale's points needn't be exactly evenly spaced, but a bigger change must mean a bigger change (see Comparable Differences); if you can't defend that, the sign test uses only the direction of each change. It also works on a single set of scores, as a one-sample test of whether they center on a value chosen in advance (roughly, a hypothesized median): subtract that value from every score and test the differences. For example:

  • Does a brisk walk take the edge off smokers' cravings?
  • Do patients rate their pain lower on a 0-to-10 scale after a hypnosis session than before it?
  • Do clients' 1-to-7 satisfaction ratings center above the scale's neutral midpoint of 4?

Vocabulary You Need

Definition Difference Score (D)

One person's score in the second condition minus their score in the first. It turns each person's pair of scores into a single number, so stable differences between people cancel out and only the change is left. Glossary →

Definition Rank

A score's position when all the scores are lined up from lowest to highest: 1 for the lowest, 2 for the next, and so on. Tied scores share the average of the positions they fill. Ranks keep the order of the scores but throw away the distances between them, so one extreme score counts only as the highest and can't dominate a rank-based test, and taking logs or square roots of the scores leaves the ranks unchanged. Glossary →

Definition Wilcoxon Signed-Rank Statistic (T)

Rank the difference scores by size, ignoring their signs, then add up the ranks of the positive differences (T₊). The negative differences' ranks make up the rest (T₋). If a rise of any size were as likely as a drop of the same size, T₊ would land near half the total. Software varies in which sum it shows; R calls T₊ V, and some programs report the smaller of the two sums. Glossary →

Assumptions and Inference

1. Independent Pairs (for the p-Value and Interval) The people (or other units) in your study don't influence each other.
What It Means
Each person's data comes from a separate, unconnected source, so knowing one person's scores tells you nothing about anyone else's. In designs that measure people more than once, their own scores are meant to be related; it's different people who must be independent. Methods built for clustered data, such as multilevel models and GEE, also allow members of the same group to be related, as long as the analysis names the grouping; then it's the groups that must be independent.
Applies To
Observations
How to Check
By design, not by a test. Did each person contribute their own data, with no clusters such as roommates, couples, therapy groups or classrooms whose members influence each other? If there are clusters, does the analysis model every one of them?
How Much It Matters
A lot. If people's changes influence each other, as when friends take part together, the test counts them as more separate pieces of evidence than they are, and p comes out too small.

What to Do

  • Alternative Test Multilevel Regression (HLM). A multilevel model, which accounts for the clustering (an ordinal one for rating scales).
  • Design Change Collect one pair of scores per independent unit, such as one person per group.
2. Symmetric Differences Your difference scores are spread about evenly around their middle.
What It Means
Strictly, the test asks whether the difference scores are symmetric around zero. It works as a test of the median change only when the differences are roughly symmetric: about as many large and small changes above the middle as below it. If they're lopsided, a significant result shows that rises and drops aren't balanced, not necessarily that the median moved.
Applies To
Differences
How to Check
Look at a histogram or dot plot of the difference scores for a long tail on one side. Don't use a test of symmetry as a gatekeeper: with small samples it misses real problems, and with large ones it flags trivial ones.
How Much It Matters
It changes what a significant result means more than whether the test runs. With lopsided changes, the test can come out significant even when the median change is zero (Divine et al., 2013), so report it as rises and drops being unbalanced, not as a shift in the median. With symmetric changes, the two readings agree.

What to Do

  • Alternative Test The sign test counts only how many changes go up and how many go down, so it tests the median change without assuming symmetry. It has less power, because it ignores how big each change is.
  • Alternative Test Paired-Samples t-Test. If the average change is what you care about, the paired t-test targets it directly and doesn't need symmetry once there are enough pairs.
  • Proceed with Caveat Show the distribution of changes and describe the result as rises outweighing drops, rather than as a change in the median.
3. Comparable Differences A bigger change on your scale means a bigger change, wherever it happens.
What It Means
The test ranks changes by size across people, so a 2-point drop has to count as more than a 1-point drop, whether it happens low or high on the scale. That asks a little more of the measure than putting scores in order does.
Applies To
Differences
How to Check
By reasoning about the measure, not by a test. For a rating scale, ask whether moving from 2 to 4 and from 7 to 9 are roughly the same amount of change for the people answering.
How Much It Matters
If a 2-point change means something different low on the scale than high on it, ranking changes across people mixes big and small changes together. For most rating scales this is a judgment call rather than a fatal flaw; if you can't defend it, use only the direction of each change.

What to Do

  • Alternative Test The sign test uses only whether each change went up or down, so it asks nothing about sizes.
  • Proceed with Caveat Say that you treated equal-sized changes as equal, and why that's reasonable for your scale.

Limitations

This Is Not Your Test If…

What It Doesn't Tell You

  • Why. Walking and sitting happened on different days in random order, so the drop can reasonably be credited to the walk, but not to the exercise itself rather than the fresh air, the distraction or the time away from cigarettes.
  • How many points. The test compares ranks, so its verdict isn't in points, but two summaries are. The median change, −1, is the middle of the 30 changes. The Hodges-Lehmann estimate, −0.5 points (95% CI −1.5 to just under 0, from all 30 changes as R computes it; dropping the 4 zeros first gives −1), is the one that matches the test: the median of the averages of every pair of changes, which R prints as the "(pseudo)median" with conf.int = TRUE. With coarse 0-to-10 ratings the two can differ by half a point.
  • Whether it matters. Significance doesn't make a 1-point drop on a 0-to-10 rating enough to keep someone from lighting up.
  • That there's no change, if p had been above .05. A non-significant result would have meant the data were inconclusive, not that walking does nothing for craving.

Common Mistakes

  • Don'tCall it a test of medians without looking at the difference scores.

    InsteadCheck the changes are roughly symmetric; if not, report that rises and drops were unbalanced.

  • Don'tAnalyze paired scores with a Mann-Whitney U test.

    InsteadPair each person's scores. The signed-rank test uses each person's own change, which is usually more powerful.

  • Don'tLeave out how many people didn't change.

    InsteadReport the number of zero differences and how the test handled them.

  • Don'tReport only z and p.

    InsteadGive the median change and the rank-biserial correlation first, then the test.

  • Don'tSwitch to a one-sided p because the result went the way you hoped.

    InsteadUse a one-sided test only if you specified the direction before collecting data and have a defensible reason why an effect in the opposite direction wouldn't count toward your claim. Otherwise use a two-sided test, as here: walking making cravings worse would matter too.

  • Don'tRead a p-value as the chance that the null hypothesis is true.

    InsteadRead it as: if the null were true, how often data at least this extreme would turn up.

Result Decoder

Significance and Effect Size Guidelines

Benchmarks Significance (p Value)
  • p < .001

    Very strong evidence against the null hypothesis.

  • .001 ≤ p < .01

    Strong evidence against the null hypothesis.

  • .01 ≤ p < .05

    Statistically significant at α = .05. Moderate evidence against the null hypothesis.

  • .05 ≤ p < .10

    Not significant. Weak evidence; sometimes called a “trend.” Treat it as inconclusive.

  • p ≥ .10

    Not significant. Little evidence against the null, which is not the same as evidence of no effect.

These evidence labels are one common convention for describing p in graded language rather than as significant or not; the boundaries are rough guides, not rules, and other authors draw them differently. Muff et al. (2022) argue for this kind of language of evidence over a single cutoff. α is chosen before the analysis, and p never says how big or important an effect is.

More about statistical significance ↓

Benchmarks Effect Size (Matched-Pairs Rank-Biserial r_{rb})
  • |r| < .10 Below Small

    Rises and drops nearly balance: neither direction has more than 55% of the rank evidence.

  • .10 ≤ |r| < .30 Small

    A small imbalance between rises and drops, by convention: changes in one direction carry 55% to 65% of the rank evidence.

  • .30 ≤ |r| < .50 Medium

    A moderate imbalance, by convention: changes in one direction carry 65% to 75% of the rank evidence, roughly two to one.

  • |r| ≥ .50 Large

    A large imbalance, by convention: changes in one direction carry at least three quarters of the rank evidence, three to one or more.

Cohen's (1988) cutoffs for a correlation, borrowed by convention. The rank shares describe the weighted balance of rises and drops, not the percentage of people who improved or worsened: bigger changes get bigger ranks, equal-sized changes share an average rank, and zero changes are left out under the Wilcoxon convention used here. These are conventional magnitudes, not measures of practical importance.

More about effect size ↓

How It's Reported

Equation Form

Example

Mdndiff = −1, rrb = −.50, 95% CI [−.76, −.11], T+ = 88, z = −2.28, p = .023

Full Text (APA Style)

Example

Smokers rated their craving lower after walking (Mdn = 5) than after sitting (Mdn = 6), a median change of −1 point: 18 craved less after walking, 8 craved more and 4 didn't change. The matched-pairs rank-biserial correlation was rrb = −.50, 95% CI [−.76, −.11]. A Wilcoxon signed-rank test on the 26 smokers whose rating changed showed the lean toward lower craving was statistically significant, T+ = 88, z = −2.28, p = .023.

  • Say which way the differences run (walking minus resting), so readers know what a negative change means, and which rank sum you report. This page reports T_+, which R calls V; some software reports the smaller of the two sums instead.
  • Say how many differences were zero and what you did with them. Here they were dropped, the usual convention.
  • Describe ordinal ratings with medians rather than means, and give the effect size, with its confidence interval, before the test. If you want a location estimate with an interval, the Hodges-Lehmann estimate (R's conf.int = TRUE) is the one that goes with this test.
  • Italicize statistical symbols (Mdn, r, T, z, p) and report exact p to three decimals.

Reading Each Piece

The equation form above, piece by piece, in this order: how big, then how surprising.

Mdndiff = −1 The typical smoker rated their craving 1 point lower on the 0-to-10 scale after walking than after sitting.
rrb = −.50 Three quarters of the rank evidence came from smokers whose craving dropped and one quarter from smokers whose craving rose. Negative means lower craving after walking. Benchmarks ↑
95% CI [−.76, −.11] With 26 smokers who changed, the interval is wide: the lean toward lower craving could be large or quite small. Here it excludes 0, in line with the significant p. It uses the normal approximation on Fisher's z scale, with n = 26 (the approach of R's effectsize package; an approximation).
T+ = 88 The rises in craving account for 88 of the 351 rank points; the drops account for the other 263.
z = −2.28 The rank sum for rises is 2.28 standard errors below what we'd expect if walking made no difference. Negative means craving tended to drop.
p = .023 If walking made no difference to craving, changes at least this unbalanced would turn up about 2% of the time. That's below .05, so the result is statistically significant. Benchmarks ↑

Calculations

The Running Example

Example

The craving study: 30 smokers, each rating their craving from 0 to 10 after sitting quietly and, on another day, after a brisk walk.

Null Hypothesis:
\theta_D = 0
Alternative (Two-Sided):
\theta_D \neq 0

D is a smoker's change, walking minus resting. \theta_D (“theta D”) is the center of the changes among all smokers like these, not just the 30 we measured; it's the median change when the changes are symmetric. Strictly, the null hypothesis says the changes are symmetric around 0, so a drop of any size is as likely as a rise of the same size.

What Your Data Should Look Like

One row per person and two numeric columns, one for each measurement. The test pairs scores by row, so both scores in a row must belong to the same person; anyone missing one of the two drops out. For the one-sample version, one numeric column and a comparison value chosen in advance.

Example
participantcraving_restcraving_walk
154
287
357
443
578
667
… 24 more rows
nMdnQ1–Q3
Craving Rest3065–7
Craving Walk3054–7
Difference30−1−2 to 0.75

Difference = Craving Walk − Craving Rest.

8 went up, 18 went down, 4 didn't change.

Q1–Q3 is where the middle half of the scores lies, from the 25th to the 75th percentile (R's default quantile definition).

Pearson correlation between the two: r = .66

Simulated data.

Download all 30 rows (data.csv)

Napkin Math

The whole test, one idea at a time. Under each heading, a line says why the step matters, and the green note reads the equation in plain English with the craving study's numbers. Collapse all to read just the headings: they tell the whole story on their own.

  1. 1. Find How Much Each Smoker's Craving Changed

    Each smoker's two ratings belong together, so we subtract them. Each smoker now has one number, their change, and the middle of all the changes is the typical change.

    \mathit{Mdn}_{\text{diff}} = \text{middle of } D_1, \dots, D_{30}

    = −1 points

    D_i is one smoker's rating after walking minus after resting. Smoker 3 went from 5 to 7, so D_3 = +2; smoker 1 went from 5 to 4, so D_1 = −1. Lined up from lowest to highest, the middle of all 30 changes is −1 point.

  2. 2. Set Aside the Smokers Whose Craving Didn't Change

    A change of zero is neither a rise nor a drop, so it can't count as either. Following the usual convention (often called Wilcoxon's method), we drop those pairs and test the rest. Pratt (1959) proposed keeping them in the ranking instead; say which you used.

    n = \text{number of nonzero } D_i =30 - 4

    = 26 smokers

    n is the number of smokers whose rating moved. 4 of our 30 rated their craving the same both days, so n = 30 − 4 = 26 smokers.

  3. 3. Rank the Changes by Size, Ignoring Direction

    Ranking keeps which change was bigger but not by how much, so one extreme change can't dominate. Changes of the same size tie, and tied changes share the average of the ranks they cover.

    R_i = \text{rank of } |D_i|

    R_{|D| = 1} = 6.5

    R_{|D| = 2} = 18.5

    R_{|D| = 3} = 25.5

    |D_i| is the size of a change, ignoring its sign. 12 smokers changed by 1 point, so they share ranks 1 to 12 and each gets their average, R = 6.5. The 12 who changed by 2 points share ranks 13 to 24, so 18.5, and the 2 who changed by 3 share 25 and 26, so 25.5.

  4. 4. Add Up the Ranks for Rises and for Drops

    Now put the signs back. If walking made no difference, the ranks of the rises and the ranks of the drops should add up to about the same amount.

    T_+ = \sum_{D_i > 0} R_i, \quad T_- = \sum_{D_i < 0} R_i =T_+ = 5 \times 6.5 + 3 \times 18.5

    = 88

    T_- = 263

    T_+ adds the ranks of the 8 smokers whose craving rose (5 by 1 point, 3 by 2 points), so 32.5 + 55.5 = 88. T_- adds the ranks of the 18 whose craving dropped, 7 × 6.5 + 9 × 18.5 + 2 × 25.5 = 263. Together they make 351, all the ranks from 1 to 26.

  5. 5. Work Out What the Rank Sum Would Look Like If Walking Did Nothing

    If walking did nothing, a drop of any size would be as likely as a rise of the same size, so each rank would be as likely to land on either side, so the rank sum for rises would average half the total. Its standard error says how far it would typically stray from that by chance. Ties shrink it slightly.

    \mu_T = \dfrac{n(n + 1)}{4}, \quad \sigma_T = \sqrt{\dfrac{n(n + 1)(2n + 1)}{24} - \dfrac{\sum (t^3 - t)}{48}} =\mu_T = \dfrac{26 \times 27}{4}, \quad \sigma_T = \sqrt{1550.25 - \dfrac{3438}{48}}

    \mu_T = 175.5

    \sigma_T = 38.45

    n is our 26 smokers, so \mu_T = 26 × 27 ÷ 4 = 175.5, half of 351. Without ties the variance would be 1550.25; our tie groups (t = 12, 12 and 2) take off 3438 ÷ 48 = 71.6, and the square root of 1478.6 is \sigma_T = 38.45.

  6. 6. Compare the Observed Rank Sum with That Expectation

    A gap only means something relative to how much the rank sum wobbles by chance. z says how many standard errors the observed sum is from the expected one.

    z = \dfrac{T_+ - \mu_T}{\sigma_T} =\dfrac{88 - 175.5}{38.45}

    = −2.28

    Our T_+ of 88, minus the 175.5 we'd expect, is −87.5. Divided by \sigma_T = 38.45, that puts the rank sum 2.28 standard errors below what we'd expect by chance alone.

  7. 7. Measure How Lopsided the Changes Are

    z grows with sample size; the rank-biserial correlation doesn't. It says what share of the rank evidence points one way rather than the other, from −1 to 1.

    r_{rb} = \dfrac{T_+ - T_-}{T_+ + T_-} =\dfrac{88 - 263}{351}

    = −.50

    95\%\ \text{CI} = [−.76, −.11]

    T_+ = 88 is 25% of the 351 rank points and T_- = 263 is 75%. 25% − 75% = −.50.

  8. 8. Ask How Surprising the Result Would Be If Walking Made No Difference

    Finally, ask how often chance alone would make the rises and drops at least this unbalanced, in either direction, if walking really changed nothing.

    p = 2 \times P(Z \ge |z|) =2 \times P(Z \ge 2.28)

    = .023

    Z stands for any value from the standard normal curve. P(Z \ge 2.28), the chance it lands 2.28 or more above 0, is the same as the chance it lands 2.28 or more below; doubling it counts both directions, .023, about 1 in 44.

Run It in Software

The code below reads the running example's data from data.csv; save it in the same folder you run the code from.

SPSS (version 30, as documented by IBM)
  1. Analyze → Nonparametric Tests → Legacy Dialogs → 2 Related Samples.
  2. Click craving_rest, then craving_walk, and move them into Test Pairs as Pair 1. SPSS subtracts Variable1 from Variable2, so this order gives walking minus resting.
  3. Under Test Type, check Wilcoxon, and click OK.

Or paste this syntax:

NPAR TESTS
  /WILCOXON=craving_rest WITH craving_walk (PAIRED)
  /MISSING ANALYSIS.

Reading the Output

SPSS prints two tables. In Ranks, read how many smokers had negative ranks (craving dropped), positive ranks (rose) and ties (no change), and the Sum of Ranks for each. Then read Z and Asymp. Sig. (2-tailed) in Test Statistics.

Ranks

N Mean Rank Sum of Ranks
craving_walk − craving_rest Negative Ranks 18 14.61 263.00
Positive Ranks 8 11.00 88.00
Ties 4
Total 30

Test Statistics

craving_walk − craving_rest
Z -2.276
Asymp. Sig. (2-tailed) .023

SPSS drops the ties (zero differences) and bases Z on the smaller rank sum, here the positive ranks, so its Z is always negative; the direction comes from the Ranks table. This procedure doesn't print an effect size or medians. Compute r_{rb} from the Sum of Ranks column, (88 − 263) ÷ 351 = −.50, and get the medians from Analyze → Descriptive Statistics → Frequencies.

Output laid out from this page's computed results, not captured from a live run; labels and layout may differ slightly in your version.

R
craving <- read.csv("data.csv")
wilcox.test(craving$craving_walk, craving$craving_rest, paired = TRUE,
            exact = FALSE, correct = FALSE, conf.int = TRUE)

# Median change and matched-pairs rank-biserial correlation
d <- craving$craving_walk - craving$craving_rest
median(d)
d <- d[d != 0]
r <- rank(abs(d))
rrb <- (sum(r[d > 0]) - sum(r[d < 0])) / sum(r)
rrb

# Approximate 95% CI for r_rb, on Fisher's z scale
n <- length(d)
se <- sqrt(n * (n + 1) * (2 * n + 1) / 6) / (n * (n + 1) / 2)
tanh(atanh(rrb) + c(-1, 1) * qnorm(0.975) * se)
	Wilcoxon signed rank test

data:  craving$craving_walk and craving$craving_rest
V = 88, p-value = 0.02288
alternative hypothesis: true location shift is not equal to 0
95 percent confidence interval:
 -1.499936e+00 -2.867901e-05
sample estimates:
(pseudo)median
    -0.5000044

[1] -1
[1] -0.4985755
[1] -0.7561334 -0.1072786

V is T_+. Put the walking scores first so the difference is walking minus resting. exact = FALSE, correct = FALSE asks for the test on this page and in SPSS: zeros dropped, normal approximation, no continuity correction (with R's default correction, p = .024). Leave exact = FALSE out and the result depends on your R version. Since R 4.6.0, R runs an exact test that allows for ties and keeps the zero differences in the ranking (as in Pratt's method), so it prints “Wilcoxon signed rank exact test,” V = 120 and p = .026; V is bigger because the 4 zeros take the lowest ranks and push every other rank up by 4. Older versions warn that they can't compute an exact p with ties and zeros, and print this page's V = 88.

conf.int = TRUE adds the Hodges-Lehmann estimate that goes with this test, the (pseudo)median change of −0.5 points, with a 95% interval from −1.5 to just under 0 (here found from the same normal approximation).

Output from a real run: R 4.6.1, run 2026-10-03.

Python
import pandas as pd
from scipy import stats

craving = pd.read_csv("data.csv")
result = stats.wilcoxon(craving["craving_walk"], craving["craving_rest"],
                        zero_method="wilcox", correction=False, method="approx")
print(result.statistic, result.zstatistic, result.pvalue)

# Median change and matched-pairs rank-biserial correlation
d = craving["craving_walk"] - craving["craving_rest"]
print(d.median())
d = d[d != 0]
r = stats.rankdata(d.abs())
print((r[d > 0].sum() - r[d < 0].sum()) / r.sum())
88.0 -2.2755114786887134 0.022875264883308318
-1.0
-0.4985754985754986

The first line is the statistic (88, the smaller rank sum, here T_+), z = −2.28 and p = .023; then the median change and r_{rb}.

zero_method="wilcox" drops the zero differences, and correction=False with the normal approximation matches SPSS and this page. SciPy 1.15 renamed method="approx" to method="asymptotic"; newer versions still accept "approx" and give the same result, but versions before 1.15 accept only "approx", so the code above runs on both. zstatistic is only there with the normal approximation.

Output from a real run: Python 3.9.6 (scipy 1.13.1, pandas 2.3.3), run 2026-10-03.

Impact

Effect Size

The matched-pairs rank-biserial correlation, r_{rb}, is the share of the rank evidence pointing one way minus the share pointing the other (Kerby, 2014). It runs from −1 (every change was a drop) to 1 (every change was a rise), with 0 meaning rises and drops balance. It has no units and doesn't grow with the number of people, so it can be compared across scales, but it still depends on the design, how varied the sample is, and how reliably things were measured.

r_{rb} = \dfrac{T_+ - T_-}{T_+ + T_-} = \dfrac{88 - 263}{351} = -.50

You'll also see r = z/\sqrt{N}, which divides z by the number of people or, in some books, by the number of scores. It isn't the same quantity as r_{rb} (here −.42 with N = 30, or −.29 with N = 60), so say which one you report.

Of the 351 rank points, 263 (75%) belonged to smokers whose craving dropped after walking and 88 (25%) to smokers whose craving rose. 25% − 75% = −.50: the evidence leans clearly toward lower craving.

Rounded, −.50 sits right on the benchmarks' “large” line, but the unrounded −.4986 falls just short of it, and the 95% confidence interval, [−.76, −.11], runs from large to small. That interval is our own calculation: the standard-error formula R's effectsize package uses, on Fisher's z scale, but counting only the 26 smokers whose craving changed. effectsize itself (version 1.0.3) counts all 30 and gives [−.74, −.14]. Both are approximations; say which you used. Read the estimate as that three-to-one split rather than as a firm label. For size in the outcome's own terms, look at the changes: the median change was −1 point on the 0-to-10 scale, a 1-point decrease, and 18 of the 30 smokers craved less after walking. Whether a point less craving keeps anyone from smoking is a question about smoking, not statistics.

Benchmarks Matched-Pairs Rank-Biserial r_{rb} at a Glance
Below Small
|r| < .10
Small
.10 ≤ |r| < .30
Medium
.30 ≤ |r| < .50
Large
|r| ≥ .50

Full benchmarks and caveats ↑

Statistical Significance

p answers one narrow question: if the changes were really balanced around zero, with a drop of any size as likely as a rise of the same size, how often would the ranks come out at least this lopsided, in either direction? Below the conventional α = .05, the result is called statistically significant.

If walking made no difference to craving, the 26 smokers whose craving changed would show rises and drops at least this unbalanced about 2.3% of the time, roughly 1 in 44. That's below .05, so it's significant.

Zero differences and software versions matter. This page's hand calculation uses Wilcoxon's convention: drop the zero differences, then rank the remaining absolute differences. Its normal approximation, with the standard error adjusted for ties, gives p = .023; that's what SPSS reports and what the R and Python code below asks for. Since version 4.6.0, R instead uses Pratt's convention by default, keeping the zero differences when assigning ranks, and in samples this size computes an exact conditional p that allows for ties and zeros: .026 here. The two differ in both the zero convention and how p is worked out, so state which convention and which method you used. With about 20 or more people who changed, the normal approximation is usually close; with fewer, use an exact p (R 4.6's default, or Exact… in SPSS's dialog). Say which you used.

p is not the probability that the null hypothesis is true, and it says nothing about how large or important the change is. That's what the median change and the effect size are for.

Benchmarks p at a Glance
Very Strong
p < .001
Strong
.001 ≤ p < .01
Significant
.01 ≤ p < .05
Weak
.05 ≤ p < .10
Little
p ≥ .10

Strength of evidence against the null hypothesis.

Full benchmarks and caveats ↑

Power and Sample Size

Power is the chance that a study detects an effect that's really there. A real effect doesn't guarantee a significant result: with too few people, it can easily come out non-significant. Power depends on how big the true effect is, how many pairs you have, α, whether the test is one- or two-sided, and, for a rank test, the shape of the changes. The same effect size gives different power for different shapes.

A practical way to plan is to work out how many pairs a paired t-test would need, then adjust. When the changes are roughly normal, the signed-rank test needs only slightly more pairs; with heavy tails or outliers it can need fewer. In large samples its efficiency relative to the t-test never falls below 0.864 (Hodges & Lehmann, 1956), so adding about 16% to the t-test's number (dividing it by 0.864) covers the worst case for continuous scores in large samples. With coarse ratings, ties and zero changes, that isn't guaranteed; simulate.

Suppose we expected craving to drop by half a standard deviation of the changes (d_z = 0.5), with roughly normal changes. A paired t-test with 34 smokers would come out significant about 81% of the time. In a simulation, the signed-rank test with 34 smokers did so about 79% of the time, and with 36 about 81%.

Researchers usually aim for at least 80% power. Plan it before collecting data, using the smallest effect that would matter. The calculator below plans in d_z, as for a paired t-test, inflated by the asymptotic efficiency factor 1 ÷ 0.864. That's a conservative planning approximation for continuous, symmetric shifts, not a guarantee for every distribution or sample size. For rating scales with many ties or zeros, simulate data that look like what you expect and count how often the test comes out significant. Try it:

Other Info

Follow-Up and Post Hoc Tests

None needed. This test answers a single question, so there are no planned contrasts or post hoc tests to run.

References

  • Wilcoxon, F. (1945). Individual comparisons by ranking methods. Biometrics Bulletin, 1(6), 80–83. https://doi.org/10.2307/3001968
    “rank numbers are assigned to the differences in order of magnitude neglecting signs, and then those rank numbers which correspond to negative differences receive a negative sign” (p. 81)
  • Pratt, J. W. (1959). Remarks on zeros and ties in the Wilcoxon signed rank procedures. Journal of the American Statistical Association, 54(287), 655–667. https://doi.org/10.1080/01621459.1959.10501526
  • Kerby, D. S. (2014). The simple difference formula: An approach to teaching nonparametric correlation. Comprehensive Psychology, 3, Article 11.IT.3.1. https://doi.org/10.2466/11.IT.3.1
  • Hodges, J. L., Jr., & Lehmann, E. L. (1956). The efficiency of some nonparametric competitors of the t-test. The Annals of Mathematical Statistics, 27(2), 324–335. https://doi.org/10.1214/aoms/1177728261
    “This result also holds for the Kruskal-Wallis test compared with the F-test, and for testing the location parameter of a single symmetric distribution.” (Abstract; “this result” is the 0.864 lower bound on efficiency relative to the t-test)
  • Muff, S., Nilsen, E. B., O'Hara, R. B., & Nater, C. R. (2022). Rewriting results sections in the language of evidence. Trends in Ecology & Evolution, 37(3), 203–210. https://doi.org/10.1016/j.tree.2021.10.009
    “we suggest language of evidence that allows for a more nuanced approach to communicate scientific findings as a simple and intuitive alternative to statistical significance testing” (Abstract)
  • Divine, G., Norton, H. J., Hunt, R., & Dienemann, J. (2013). A review of analysis and sample size calculation considerations for Wilcoxon tests. Anesthesia & Analgesia, 117(3), 699–710. https://doi.org/10.1213/ANE.0b013e31827f53d7
    “a single sample that has a median of zero, yet there is a substantial shift for much of the nonzero data, and the Wilcoxon signed rank test is quite significant” (Abstract)

Spot an error? Something still confusing? Tell us at support@statsforpsychology.com.