Matched pairs · mean vs signed ranks

Paired t test or Wilcoxon? Do not swap the question silently.

Both tests preserve the same ten patient pairs. One targets the mean paired difference; the other ranks non-zero differences and tests a symmetric location shift. “Non-normal” is not a complete decision rule.

10 matched patients2 paired analysesAll differences visible8-minute read

The short answer

Choose the estimand before comparing the P values.

Paired t test

How large is the mean paired difference?

Analyze one difference per independent pair. Small-sample t inference assumes those differences are approximately Gaussian; the raw columns do not each need to be Gaussian.

Wilcoxon signed-rank

Are signed difference ranks centered on zero?

Rank the magnitudes of non-zero paired differences, restore their signs and compare the positive and negative rank sums. A location interpretation requires a meaningful, roughly symmetric difference distribution.

Not a valid workflow: run a normality test, choose whichever analysis gives the preferred P value and then report that result as if it had been pre-specified. Define the scientific target and sensitivity analysis before inspecting significance.

The same canonical sleep pairs

R's sleep dataset records extra hours of sleep from two soporific drugs in the same ten patients. The difference below is Drug 1 minus Drug 2, so a negative value means more extra sleep under Drug 2.

Patient Drug 1 Drug 2 Difference Signed-rank contribution
1 0.7 1.9 −1.2 −3
2 −1.6 0.8 −2.4 −8
3 −0.2 1.1 −1.3 −4.5
4 −1.2 0.1 −1.3 −4.5
5 −0.1 −0.1 0.0 Excluded zero
6 3.4 4.4 −1.0 −2
7 3.7 5.5 −1.8 −7
8 0.8 1.6 −0.8 −1
9 0.0 4.6 −4.6 −9
10 2.0 3.4 −1.4 −6
−5 −4 −3 −2 −1 0 Drug 1 − Drug 2 extra sleep (hours)
The largest difference, −4.6 hours, drives the visible left tail. Plot the paired differences; neither pair of raw-column histograms shows the assumption that matters.

Paired t test: a mean-difference result

The ten differences have mean −1.58 hours and SD 1.230 hours. Plotwright reports t(9) = −4.062, P = 0.002833, with a 95% confidence interval from −2.46 to −0.70 hours. Cohen's dz is −1.285.

The engine's D'Agostino–Pearson check on the differences gives P = 0.00346, driven by the asymmetric left tail. That diagnostic is a reason to inspect the difference distribution and the scientific scale—not an automatic command to discard the mean.

Wilcoxon: a signed-rank result

One zero difference is removed. All nine remaining differences are negative, giving W+ = 0 and W = 45. Under the exact sign permutations, only the all-negative and all-positive assignments are as extreme: P = 2/2⁹ = 0.003906 (two-sided).

The matched-pairs rank-biserial correlation is −1.000. The Hodges–Lehmann pseudomedian is −1.40 hours, with the engine's 95% interval from −2.95 to −1.05 hours. These are rank-based location summaries; they do not turn the Wilcoxon test into a general test of the arithmetic mean.

The two P values agree. The questions do not.

Mean paired difference −1.58 h · P = 0.002833

Use when the mean difference is the scientific target and its sampling model is defensible.

Signed-rank location HL −1.40 h · P = 0.003906

Use when ranks and a symmetric location-shift interpretation match the question.

In this dataset both analyses support a systematic difference. That agreement is reassuring, but it is not a license to report only whichever number looks stronger. If the target is a mean treatment effect, changing to ranks changes the target. If difference magnitudes are unreliable but their ordering is meaningful, the rank analysis may be more defensible.

Assumptions and limits

  • Pairs must come from the design, and different pairs must be independent.
  • The paired t test models the mean of the paired differences, not the two raw distributions separately.
  • The Wilcoxon calculation requires differences that can be meaningfully ordered; zero differences and tied magnitudes affect its implementation.
  • Interpreting signed ranks as a single location shift relies on a roughly symmetric difference distribution.
  • A small sample provides weak evidence about distribution shape. Use design knowledge, plots and sensitivity analysis rather than a preliminary test alone.
  • More than two repeated times require a repeated-measures or mixed model, not a sequence of paired tests.

Reporting templates

Paired t: “Drug 1 minus Drug 2 extra sleep had a mean difference of −1.58 hours (95% CI −2.46 to −0.70), paired t(9) = −4.062, two-sided P = 0.002833.”

Signed-rank: “Nine paired differences were negative and one was zero. The Wilcoxon signed-rank test gave W+ = 0, W = 45, exact two-sided P = 0.003906; the Hodges–Lehmann pseudomedian was −1.40 hours.”

State the difference direction, zero-difference convention, exact or asymptotic method, effect estimate and why the chosen estimand answers the study question.

What the executable checks establish

Both editable projects contain the same twenty published measurements in the same row order. Engine tests reproduce the paired t statistic and interval from the differences. The signed-rank result is checked against SciPy and an independent enumeration of all 2⁹ sign assignments for the nine non-zero ranks.

Those checks establish numerical consistency for this dataset. They do not decide which estimand matters for a new experiment, prove symmetry or normality, or repair pairing that was not part of the design.

Sources and further reading

  1. R Core Team. sleep: Student's sleep data—the canonical measurements and paired-example warning.
  2. R Core Team. wilcox.test documentation—paired signed-rank arguments, estimates and interval conventions.
  3. NIST/SEMATECH. Signed rank test—ranking procedure and assumptions.
  4. Fay MP, Proschan MA. Wilcoxon's signed-rank statistic: what null hypothesis and why it matters. Statistics Surveys. 2010;4:1–39.
  5. Whitley E, Ball J. Statistics review 6: Nonparametric methods. Critical Care. 2002;6:509–513.

Keep the pairs fixed. Change only the analysis.

Open either route with the same ten patients, an editable before-after graph and the corresponding preselected engine analysis.