Wilcoxon Signed-Rank Test Calculator

Test paired samples for differences using the non-parametric Wilcoxon signed-rank test, which requires no assumption about the shape of the distribution.

W
N (Pairs, Zeros Excluded)
Z
P (2-Tailed)
There is not enough evidence to reject H₀ at α = .05
Standard normal distribution with test statistic marked −4 −2 0 2 4 6
Fig. 1 — Standard normal distribution under the null hypothesis. The rejection region (α = .05, two-tailed) is shaded in red. Your observed z-statistic is marked when both samples are entered.

§1 The Formula

W = min(W⁺, W⁻); z = (W − μ_W ± 0.5) / σ_W
W
Test statistic: the smaller of the sums of signed ranks.
W⁺
Sum of ranks for positive differences (after − before).
W⁻
Sum of ranks for negative differences.
μ_W
Mean under null hypothesis: n(n + 1) / 4, where n is the number of pairs after removing zeros.
σ_W
Standard deviation, corrected for ties: √[n(n + 1)(2n + 1) / 24 − ΣT / 48], where T = t(t² − 1) for each tie group of size t.
z
Standardized test statistic with ±0.5 continuity correction.
p
Two-tailed probability from the standard normal distribution.

§2 Worked Example

Six participants were assessed before and after a training intervention. Does the training produce a measurable change?

ParticipantBeforeAfterDifference (d)|d|RankSigned Rank
12225333+3
21819111+1
32018−222−2
42527222+2
51920111+1
62322−111−1

Absolute differences: 3, 1, 2, 2, 1, 1. No zeros are dropped. Ranking |d| in ascending order: 1, 1, 1, 2, 2, 3. Ties occur at rank 1 (three participants) and rank 4 (two participants: average rank = 1.5 and 4.5, respectively). After assigning average ranks and applying signs:

W⁺ = 3 + 1.5 + 2 + 1.5 = 8; W⁻ = 2 + 1.5 = 3.5; W = min(8, 3.5) = 3.5

With n = 6, μ_W = 6 × 7 / 4 = 10.5. Tie correction: T = 3(3² − 1) + 2(2² − 1) = 24 + 6 = 30. σ_W = √[6 × 7 × 13 / 24 − 30 / 48] = √[22.75 − 0.625] = √22.125 ≈ 4.704. z = (3.5 − 10.5 + 0.5) / 4.704 ≈ −1.489. This yields p ≈ .137 (two-tailed). We fail to reject H₀ at α = .05.

§3 Assumptions and When This Test Is Wrong

Required assumptions

  • Paired samples: Observations must come in matched pairs (e.g. before–after, or person A vs. person B matched on a control variable).
  • Differences are ordinal or better: The differences must be rankable; you must be able to say whether |d_i| > |d_j|.
  • Symmetric distribution of differences under H₀: For the inference to be about the median of the differences, assume the distribution of differences is symmetric. If it is skewed, the test still controls Type I error but addresses the Hodges–Lehmann estimator instead.

When you should use a different test

  • Independent samples (not paired): Use the Mann–Whitney U test instead.
  • More than two related samples: Use the Friedman test or the Skillings–Mack test.
  • Differences are categorical: Use McNemar's test or sign test.
  • Large sample and normality is plausible: A paired t-test may have more power; always check a Q–Q plot or Shapiro–Wilk test first.
  • Sample size is small (n < 20): Consider consulting exact critical-value tables from statistical tables or software (e.g. R's wilcox.test(..., exact=TRUE)). This calculator uses the normal approximation, which is least accurate for tiny samples.

§4 Frequently Asked Questions

Why is a zero difference dropped?

Zero differences carry no information about the direction of change. The standard Wilcoxon procedure removes them and reduces n accordingly. This is not optional—it is the published rule. This calculator will show you how many zeros were dropped in the steps.

What if I have many ties?

Ties are handled by assigning the average rank to all tied observations. This calculator applies the tie-correction formula σ_W = √[n(n + 1)(2n + 1) / 24 − ΣT / 48], which inflates the standard error slightly. If you have very many ties (e.g., categorical data squeezed into a numeric ranking), the Wilcoxon test may lose power; consider whether a sign test or McNemar's test is more appropriate.

How do I interpret the p-value?

The p-value is the probability of observing a test statistic as extreme as (or more extreme than) the one you calculated, if the null hypothesis were true (i.e., if the two samples come from identical distributions). It does not say "the probability that the null hypothesis is true." A p-value of 0.03 means: if there were no true difference, you would see a result this extreme about 3 times in 100 replications. Decide in advance whether you will use α = .05 or another threshold.

Can I use this for one-tailed tests?

This calculator reports the two-tailed p-value. If you want a one-tailed p-value, divide the displayed p-value by 2. However, decide on a direction before looking at your data, and always report which direction you tested.

What is the Hodges–Lehmann estimator?

It is the median of all pairwise differences between one group and the other. For symmetric distributions, it equals the median difference; for asymmetric distributions, it is a robust location shift. Many statisticians report the Hodges–Lehmann estimator and a confidence interval around it alongside the Wilcoxon test, because the p-value alone does not tell you the size or direction of the effect. This calculator focuses on the p-value; for confidence intervals, consult R's wilcox.test(..., conf.int=TRUE).

How do I report this test?

Standard format: "A Wilcoxon signed-rank test indicated no significant difference between the two conditions (W = 8, N = 10 (excludes 1 zero), p = .438, two-tailed)." Be sure to report W, the effective sample size (excluding zeros), and the p-value. A brief interpretation of what the p-value means will help your reader.

§5 Sources

  • Wilcoxon, F. (1945). Individual comparisons by ranking methods. Biometrics Bulletin, 1(6), 80–83. — The original paper.
  • Conover, W. J. (1999). Practical nonparametric statistics (3rd ed.). Wiley. — Standard textbook; Chapter 3 covers signed-rank tests in detail, including tie corrections.
  • Hollander, M., & Wolfe, D. A. (1999). Nonparametric statistical methods (2nd ed.). Wiley. — Authoritative reference on all nonparametric methods, with exact tables and approximations.
  • NIST/SEMATECH e-Handbook of Statistical Methods (2013). https://www.itl.nist.gov/div898/handbook/ — Section on nonparametric methods includes Wilcoxon test guidance.
  • UCLA OARC Statistical Methods and Data Analysis. https://stats.oarc.ucla.edu/ — Tutorials on Wilcoxon test in SAS, SPSS, R, and Stata.
  • OpenStax Introductory Statistics 2e (2024). Chapter 13 covers nonparametric methods, including Wilcoxon signed-rank test. Free and openly licensed.