Wilcoxon Rank-Sum & Signed-Rank Test Calculator
Two Wilcoxon non-parametric tests in one: rank-sum for independent groups, signed-rank for paired data.
📖 What are the Wilcoxon Tests?
Frank Wilcoxon introduced two landmark non-parametric tests in a single 1945 paper that transformed statistical practice by providing rigorous alternatives to the t-test that required no distributional assumptions. The Wilcoxon rank-sum test compares two independent groups by converting all observations to ranks and testing whether the rank sums are consistent with the groups coming from the same distribution. The Wilcoxon signed-rank test tests paired data by ranking the absolute values of differences and testing whether positive and negative rank sums are balanced.
The rank-sum test is mathematically identical to the Mann-Whitney U test: both tests are computing the same quantity with a linear transformation. The key is that by converting to ranks, both tests become distribution-free - valid regardless of whether the data is normal, skewed, heavy-tailed, or bounded. They are robust to outliers because an extreme value is simply the highest-ranked observation and cannot pull the test statistic arbitrarily far from zero as it would with a mean-based test.
The signed-rank test is the paired counterpart to the rank-sum test, analogous to the paired t-test. It computes differences between paired observations, removes zero differences, ranks the absolute differences, then splits into positive-rank-sum W+ and negative-rank-sum W−. Under the null hypothesis that the median difference is zero, W+ and W− should be approximately equal. The test statistic W = min(W+, W−) is compared to its expected distribution (exactly for small n, normally approximated for large n).
Both tests handle ties by assigning average ranks, with a tie correction applied to the variance formula to maintain accurate p-values. The signed-rank test additionally excludes zero differences (tied pairs) from the analysis. These tests are standard in medical research, psychology, ecology, and any field where data quality or distribution shape make parametric assumptions questionable.
📐 Formulas
Rank-Sum W: Sum of ranks in the smaller group. Expected value = n_s(n+1)/2.
Variance with tie correction: σ²_W = n_s × n_l / 12 × [(n+1) − ΣT/(n(n−1))] where T = Σtᵢ(tᵢ²−1) for each tie group.
U equivalent: U₁ = n₁n₂ + n₁(n₁+1)/2 − W₁
Signed-Rank:
1. Compute differences dᵢ = x₁ᵢ − x₂ᵢ. Discard zeros.
2. Rank |dᵢ| in ascending order (average ties).
3. W+ = sum of ranks where dᵢ > 0; W− = sum of ranks where dᵢ < 0.
4. W = min(W+, W−). Expected = n(n+1)/4.
5. σ²_W = n(n+1)(2n+1)/24 − TC/48, where TC = Σtᵢ(tᵢ²−1) (tie correction for signed-rank).
6. Z = (W − E[W]) / σ_W; p-value from standard normal (two-tailed).