The Wilcoxon signed-rank test is a non-parametric statistical hypothesis test used when comparing
two related samples, matched samples, or repeated measurements on a single sample to assess
whether their population mean ranks differ.
It can be used as an alternative to the paired Student's t-test, t-test for matched pairs,
or the t-test for dependent samples when the population cannot be assumed to be normally
distributed.
The Wilcoxon signed-rank test is not the same as the Wilcoxon rank-sum test, although both
are nonparametric and involve summation of ranks.
History The test is named for Frank Wilcoxon who,
in a single paper, proposed both it and the rank-sum test for two independent samples.
The test was popularized by Sidney Siegel in his influential text book on non-parametric
statistics.
Siegel used the symbol T for a value related to, but not the same as, . In consequence,
the test is sometimes referred to as the Wilcoxon T test, and the test statistic is reported
as a value of T. Assumptions
Data are paired and come from the same population.
Each pair is chosen randomly and independently.
The data are measured at least on an ordinal scale, but need not be normal.
Test procedure Let be the sample size, the number of pairs.
Thus, there are a total of 2N data points.
For , let and denote the measurements.
H0: median difference between the pairs is zero
H1: median difference is not zero.
For , calculate and , where is the sign function.
Exclude pairs with . Let be the reduced sample size.
Order the remaining pairs from smallest absolute difference to largest absolute difference,
. Rank the pairs, starting with the smallest
as 1.
Ties receive a rank equal to the average of the ranks they span.
Let denote the rank.
Calculate the test statistic , the absolute value of the sum of the signed ranks.
As increases, the sampling distribution of converges to a normal distribution.
Thus, For , a z-score can be calculated as .
If then reject
For , is compared to a critical value from a reference table.
If then reject
Alternatively, a p-value can be calculated from enumeration of all possible combinations
of given .
The T statistic used by Siegel is the smaller of two sums of ranks of given sign; in the
example given below, therefore, T would equal 3+4+5+6=18.
Low values of T are required for significance.
As will be obvious from the example below, T is easier to calculate by hand than W.
Excluding zeros is not a statistically justified method and such an approach can lead to enormous
calculation errors.
A more stable method is: Calculate , = 0)
Calculate sampling probabilities For use normal appoximation
Example is the sign function, is the absolute value,
and is the rank.
Notice that pairs 3 and 9 are tied in absolute value.
They would be ranked 1 and 2, so each gets the average of those ranks, 1.5.
See also Mann-Whitney-Wilcoxon test
Sign test References
External links Wilcoxon Signed-Rank Test in R
Description of how to calculate p for the Wilcoxon signed-ranks test
Example of using the Wilcoxon signed-rank test
An online version of the test A table of critical values for the Wilcoxon
signed-rank test Implementations
ALGLIB includes implementation of the Wilcoxon signed-rank test in C++, C#, Delphi, Visual
Basic, etc.
The free statistical software R includes an implementation of the test as wilcox.test(x,y,
paired=TRUE), where x and y are vectors of equal length.
GNU Octave implements various one-tailed and two-tailed versions of the test in the wilcoxon_test
function.
SciPy includes an implementation of the Wilcoxon signed-rank test in Python