induwara.lk
induwara.lkStatistics · Non-parametric

Wilcoxon Signed-Rank Test Calculator

Compare paired before/after data — or one sample against a median — when the differences aren't normally distributed. Paste your numbers to get W⁺, W⁻, an exact or tie-corrected p-value, an effect size, and every ranking step, all in your browser with no signup.

By Induwara AshinsanaUpdated Jul 10, 2026
Wilcoxon signed-rank test
Exact + tie-corrected · cross-checked
Input mode
6 values

Paste numbers separated by commas, spaces, or new lines.

6 values

Must line up with Sample A — one after-value per before-value.

Try an example
Alternative hypothesis
Zero differences
Fail to reject H₀ — no significant shift in the paired differences (p = 0.0625 ≥ α = 0.05).
Method: Exact test — enumerated null distribution over 2^6 = 64 equally likely sign patterns (no ties).
W statistic
1
W⁺ = 20 · W⁻ = 1
p-value (two-sided)
0.0625
exact enumeration
Rank-biserial r
0.905
large · increase
Non-zero pairs (n)
6
no zeros

Ranking worktable

#BeforeAfterdᵢ|dᵢ|RankSign
11012222+
21015555+
3109-111
41013333+
51017776+
61014444+
Signed-rank sums — W⁺ = 20, W⁻ = 121

Cross-check: W⁺ + W⁻ = 21 must equal Σ of the ranked ranks = 21matches ✓.

Show working

  1. n (non-zero pairs) = 6; median of differences = 3.5
  2. W⁺ = 20, W⁻ = 1 → W = min(W⁺, W⁻) = 1
  3. Identity: W⁺ + W⁻ = 21 = Σ ranks = 21
  4. μ_W⁺ = (Σ ranks)/2 = 10.5
  5. σ²_W⁺ = ¼·Σ rank² = 22.75 → σ_W⁺ = 4.7697
  6. cross-check σ²_W⁺ via NIST n(n+1)(2n+1)/24 − Σ(t³−t)/48 = 22.75 ✓
  7. z (no correction) = (W⁺ − μ)/σ = 1.99174
  8. z (continuity-corrected) = 1.88691
  9. p-value: exact enumeration of the 2^6 equally likely sign patterns of the ranks.
  10. Effect size: r = (W⁺ − W⁻)/(W⁺ + W⁻) = 0.9048
Sources cited

How it works

The Wilcoxon signed-rank test is the non-parametric alternative to the paired t-test. Instead of comparing the mean of the paired differences, it ranks the sizesof those differences and asks whether the positive and negative ranks balance out — so skew, outliers, and ordinal data don't break it. It works on two paired columns (the same subjects measured twice) or on one sample against a hypothesised median μ₀.

  1. Form the differences.For paired data, dᵢ = afterᵢ − beforeᵢ; for a one-sample test, dᵢ = valueᵢ − μ₀. Any dᵢ = 0 carries no direction, so the standard Wilcoxon rule discards it and reduces n. Pratt's (1959) option keeps zeros while ranking but still excludes them from W⁺ and W⁻.
  2. Rank the absolute differences. Sort |dᵢ| from smallest to largest and assign ranks 1…n, giving tied magnitudes the average of the ranks they span (Wilcoxon, 1945). Two values tied for ranks 3 and 4 each become 3.5.
  3. Sum the signed ranks. W⁺ = Σ ranks where dᵢ > 0 and W⁻ = Σ ranks where dᵢ < 0. As a check, W⁺ + W⁻ must equal n(n+1)/2. The reported statistic is W = min(W⁺, W⁻).
  4. Exact p-value (small, tie-free samples). Under H₀ each rank is independently positive or negative with probability ½, so W⁺ ranges over the 2ⁿ equally likely sign assignments. This tool enumerates that null distribution and reads the tail directly: two-sided p = 2·min(P(W⁺ ≤ w), P(W⁺ ≥ w)), capped at 1.
  5. Normal approximation (ties or larger samples). Otherwise it uses μ_W⁺ = n(n+1)/4 and σ²_W⁺ = n(n+1)(2n+1)/24 − Σ(tⱼ³−tⱼ)/48, where tⱼ is the size of each group of tied |dᵢ| (NIST e-Handbook). The z-score z = (W⁺ − μ_W⁺ ∓ ½)/σ_W⁺ — with an optional ±0.5 continuity correction toward the mean — is read against the standard-normal distribution.

The effect size is the matched-pairs rank-biserial correlation r = (W⁺ − W⁻)/(W⁺ + W⁻), bounded in [−1, 1] (Kerby, 2014): positive means values tended to rise. This module computes σ² straight from the ranks as ¼·Σrᵢ², which equals the NIST closed form exactly and is shown reconciled against it in the working. Every step runs client-side, so nothing you paste leaves your device.

Worked examples

Small sample, no ties — exact path

d = +2, +5, −1, +3, +7, +4 (n = 6)

  1. Sorted |d| = 1, 2, 3, 4, 5, 7 → ranks 1, 2, 3, 4, 5, 6
  2. Only d = −1 is negative (rank 1) → W⁻ = 1, W⁺ = 2+3+4+5+6 = 20
  3. Check: W⁺ + W⁻ = 21 = 6·7/2 ✓ → W = min(20, 1) = 1
  4. Exact: subsets of {1..6} with sum ≥ 20 are {21} and {20} → P(W⁺ ≥ 20) = 2/64 = 0.03125
  5. Two-sided p = 2 × 0.03125 = 0.0625 → fail to reject at α = 0.05
  6. Effect size: r = (20 − 1)/21 = 0.905 (large, increase)

Ties and zeros — normal approximation

d = 0, −1, 2, 3, 3, −2, 4, 5, 0, 6, 1, −3 (12 pairs)

  1. Two zeros discarded → n = 10 non-zero differences
  2. |d| ranks: 1→1.5,1.5; 2→3.5,3.5; 3→6,6,6; 4→8; 5→9; 6→10
  3. Negatives −1(1.5), −2(3.5), −3(6) → W⁻ = 11, W⁺ = 55 − 11 = 44 (check 55 = 10·11/2 ✓)
  4. μ_W⁺ = 27.5; Σr² = 382 → σ²_W⁺ = 95.5, σ_W⁺ = 9.7724 (NIST: 96.25 − 0.75 ✓)
  5. z = (44 − 27.5 − 0.5)/9.7724 = 1.637 → two-sided p ≈ 0.102 → fail to reject at α = 0.05
  6. Effect size: r = (44 − 11)/55 = 0.60 (large, increase)

Edge case — fractional one-sample test, exact one-sided

values = −0.5, 1.5, 2.25 vs μ₀ = 0 → d = −0.5, +1.5, +2.25 (n = 3)

  1. Sorted |d| = 0.5, 1.5, 2.25 → ranks 1, 2, 3 (no ties)
  2. d = −0.5 is negative (rank 1) → W⁻ = 1, W⁺ = 2 + 3 = 5, W = 1
  3. Exact over 2³ = 8 sign patterns: subsets of {1,2,3} with sum ≥ 5 are {5}, {6} → P(W⁺ ≥ 5) = 2/8 = 0.25
  4. One-sided “increase” p = 0.25 → fail to reject at α = 0.05
  5. Effect size: r = (5 − 1)/6 = 0.667 (large, increase)

Frequently asked questions

Sources & references

Related tools

Rate this tool
Be the first to rate

Comments & feedback

Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.

Found a bug, edge case, or want to suggest an improvement?

Email me at [email protected] — most fixes ship within 24 hours.