About the Wilcoxon Signed-Rank Test Calculator
This Wilcoxon signed-rank test calculator runs the paired nonparametric test step by step. Paste the first measurements (for example “before”) and the matching second measurements (“after”) and it computes each difference, drops zero differences, ranks the absolute differences (ties share the average rank), attaches the signs and adds up the positive and negative rank sums W+ and W−. The p-value is exact for up to 50 untied differences, or comes from the normal approximation with tie and continuity corrections.
It is the nonparametric alternative to the paired t-test. Use it for before/after studies, matched pairs, crossover trials or repeated ratings when the differences are skewed, contain outliers, or are ordinal scores where averages are questionable. Leave the second box empty to run a one-sample signed-rank test of whether a single sample’s median equals a hypothesised value.
The test assumes the pairs are independent of each other and that the distribution of differences is roughly symmetric about its median. Zero differences are discarded (Wilcoxon’s original method, the default in R and SciPy), so the effective sample size n can be smaller than the number of pairs you enter.
With the default inputs, the p-value is 0.0053. Change any value above to recalculate instantly.
How to use the wilcoxon signed-rank test calculator
- 1Paste the first set of measurements (e.g. before) into Sample 1.
- 2Paste the matching second measurements, in the same order, into Sample 2 — or leave it blank for a one-sample test.
- 3Set the hypothesised median difference (usually 0) and choose the alternative hypothesis.
- 4Read the p-value and decision, then check W+, W− and the signed-rank table.
Formula and method
Each pair gives a difference d; differences of exactly zero are dropped, leaving n. The absolute differences are ranked from 1 to n with ties sharing their average rank, and each rank takes the sign of its difference. W+ is the sum of the positive ranks and W− the sum of the negative ranks; together they always add up to n(n + 1)/2. If the median difference really is m₀, positive and negative ranks should balance and W+ should be near n(n + 1)/4.
For up to 50 untied differences the calculator enumerates all 2ⁿ equally likely sign patterns to get an exact p-value. Otherwise it uses the normal approximation with the tie-corrected variance and an optional 0.5 continuity correction, matching R’s wilcox.test and SciPy’s wilcoxon. Many printed tables compare T = min(W+, W−) with a critical value; the p-value here leads to the same decision.
- dᵢ
- Difference for pair i, minus the hypothesised median difference m₀
- n
- Number of non-zero differences
- W+, W−
- Sums of the ranks of positive and negative differences
- t
- Size of each group of tied absolute differences
- μ, σ
- Mean and standard deviation of W+ under the null hypothesis
Worked examples
Blood pressure before and after a programme
Ten of the twelve differences are positive. The two negative differences (−1 and −2) take ranks 1 and 2, so W− = 3 and W+ = 78 − 3 = 75. Because two pairs of differences are tied, the normal approximation with tie and continuity corrections is used: σ² = 162.5 − 12/48 = 162.25, so z = (75 − 39 − 0.5) ÷ 12.738 ≈ 2.79 and p ≈ 0.0053.
Small exact test with no ties
The eight differences are 0.6, 0.3, 0.9, −0.15, 1.2, 0.7, 1.4 and 0.5, all distinct. Only −0.15 is negative and it has the smallest absolute value, so W− = 1 and W+ = 36 − 1 = 35. Of the 2⁸ = 256 equally likely sign patterns, 2 give a W+ of 35 or more and 2 give 1 or less, so the exact two-tailed p = 4 / 256 ≈ 0.0156.
One-sample test against a target median
Subtracting the target of 50 leaves nine positive differences and one negative (47 − 50 = −3), which ranks second smallest in absolute size. So W− = 2 and W+ = 55 − 2 = 53. Only 3 of the 1,024 sign patterns give W+ ≥ 53, so the exact one-tailed p = 3 / 1,024 ≈ 0.0029: the median is above 50.
Frequently asked questions
When should I use the Wilcoxon signed-rank test instead of a paired t-test?+
Use it when the paired differences are clearly non-normal, skewed or contain outliers, or when the data are ordinal scores. With large samples of roughly normal differences, the paired t-test is slightly more powerful.
What happens to zero differences?+
They are dropped before ranking (Wilcoxon’s method), so n counts only the non-zero differences. This is the default in R and SciPy. The calculator reports how many zeros were removed.
What is the difference between W, T and V?+
W+ is the sum of positive ranks (R reports it as V), W− is the sum of negative ranks and T = min(W+, W−) is the value compared with critical-value tables. They contain the same information because W+ + W− = n(n + 1)/2.
Is the Wilcoxon signed-rank test the same as the Wilcoxon rank-sum test?+
No. The signed-rank test is for paired or one-sample data. The rank-sum test, also called the Mann-Whitney U test, compares two independent groups.
What does the signed-rank test assume?+
The pairs must be independent of each other, the differences must be measured on at least an interval-like scale so they can be ranked, and the distribution of differences should be roughly symmetric around its median.
How do I report the result?+
A typical report is: “A Wilcoxon signed-rank test showed that blood pressure was lower after the programme, T = 3, z = 2.79, p = .005, r = .80, n = 12.” Include the medians of both conditions for context.