The Wilcoxon Signed-Rank Test is a non-parametric statistical test used to determine if there is a significant difference between two related samples or repeated measurements on a single sample. It serves as an alternative to the paired-samples t-test when the assumption of normally distributed differences is not met. The test is used for "within-subjects" designs, such as comparing scores before and after an intervention.
This test is appropriate when you have two sets of scores that are related or paired. For example, you might use it to compare the anxiety levels of individuals before and after a therapy program, or to compare the performance of employees on two different tasks. The key requirement is that the data comes in matched pairs and the differences between these pairs are what you wish to analyze.
The test works by calculating the differences between each pair, ranking the absolute values of these differences, and then summing the ranks of the positive and negative differences. The output includes:
Q1: How is the W statistic calculated manually?
The calculation follows these steps:
Q2: What is the difference between the Wilcoxon Signed-Rank Test and the Mann-Whitney U Test?
The main difference lies in the study design they are used for.
Q3: How is the Z-approximation calculated for this test?
For larger sample sizes (e.g., \(n > 20\)), a normal approximation with a Z-score is used to find the p-value. The Z-score is calculated as:
$$ Z = \frac{W - \mu_W}{\sigma_W} $$Where:
Q4: What are the null and alternative hypotheses?
The hypotheses for the two-tailed test are:
The weight-loss example data used by default in this calculator (Group 1 "before" vs. Group 2 "after") can be reproduced directly in the following tools.
R's built-in wilcox.test() function performs the paired Wilcoxon test directly:
before <- c(110, 115, 120, 122, 125, 128, 130, 131, 135, 140)
after <- c(105, 110, 112, 125, 124, 120, 122, 128, 130, 132)
wilcox.test(after, before, paired = TRUE, correct = TRUE)
Note: R disables the exact p-value automatically when ties are present and falls back to the normal
approximation (matching this calculator), unless you set exact = FALSE explicitly.
scipy.stats.wilcoxon runs the same test, with the normal approximation available via mode='approx':
from scipy.stats import wilcoxon
before = [110, 115, 120, 122, 125, 128, 130, 131, 135, 140]
after = [105, 110, 112, 125, 124, 120, 122, 128, 130, 132]
stat, p = wilcoxon(after, before, mode='approx', correction=True)
print(stat, p)
Analyze → Nonparametric Tests → Legacy Dialogs → 2 Related Samples. Move your two paired variables into the Test Pair(s) List, and make sure Wilcoxon is checked under Test Type, then click OK. SPSS reports the ranks table (positive, negative, and tied ranks), the Z-statistic, and the two-tailed p-value.
T-Tests → Paired Samples T-Test. Move your two variables into the Paired Variables box, then under Tests, uncheck Student and check Wilcoxon signed-rank instead. JASP outputs the W statistic and p-value directly, alongside an option to show descriptive plots of the paired differences.