# Wilcoxon signed-rank test

From Wikipedia, the free encyclopedia - View original article

Jump to: navigation, search

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 (i.e. it is a paired difference test). 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.[1]

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 (1892–1965) who, in a single paper, proposed both it and the rank-sum test for two independent samples (Wilcoxon, 1945).[2] The test was popularized by Sidney Siegel (1956)[3] in his influential text book on non-parametric statistics. Siegel used the symbol T for a value related to, but not the same as, $W$. 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

1. Data are paired and come from the same population.
2. Each pair is chosen randomly and independently.
3. The data are measured at least on an ordinal scale, but need not be normal.

## Test procedure

Let $N$ be the sample size, the number of pairs. Thus, there are a total of 2N data points. For $i = 1, ..., N$, let $x_{1,i}$ and $x_{2,i}$ denote the measurements.

H0: median difference between the pairs is zero
H1: median difference is not zero.
1. For $i = 1, ..., N$, calculate $|x_{2,i} - x_{1,i}|$ and $\sgn(x_{2,i} - x_{1,i})$, where $\sgn$ is the sign function.
2. Exclude pairs with $|x_{2,i} - x_{1,i}| = 0$. Let $N_r$ be the reduced sample size.
3. Order the remaining $N_r$ pairs from smallest absolute difference to largest absolute difference, $|x_{2,i} - x_{1,i}|$.
4. Rank the pairs, starting with the smallest as 1. Ties receive a rank equal to the average of the ranks they span. Let $R_i$ denote the rank.
5. Calculate the test statistic $W$
$W = |\sum_{i=1}^{N_r} [\sgn(x_{2,i} - x_{1,i}) \cdot R_i]|$, the absolute value of the sum of the signed ranks.
6. As $N_r$ increases, the sampling distribution of $W$ converges to a normal distribution. Thus,
For $N_r \ge 10$, a z-score can be calculated as $z = \frac{W - 0.5}{\sigma_W}, \sigma_W = \sqrt{\frac{N_r(N_r + 1)(2N_r + 1)}{6}}$.
If $z > z_{critical}$ then reject $H_0$

For $N_r < 10$, $W$ is compared to a critical value from a reference table.[1]

If $W \ge W_{critical, N_r}$ then reject $H_0$

Alternatively, a p-value can be calculated from enumeration of all possible combinations of $W$ given $N_r$.

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:[4]

• Calculate $W = \sum_{i=1}^{N} [\sgn(x_{2,i} - x_{1,i}) \cdot R_i]$, (assume sgn(0) = 0)
• Calculate sampling probabilities $\pi^+ = P(x_{2,i} > x_{1,i}), \pi^- = P(x_{2,i} < x_{1,i}), \pi^0 = P(x_{2,i} = x_{1,i})$
• For ${N \ge 10}$ use normal approximation ${Z = \frac{4W - N(N+1)}{\sqrt{\frac{2N(N+1)(2N+1)}{3}(\pi^+ + \pi^- - (\pi^+ - \pi^-)^2)}}}$

## Example

 $x_{2,i} - x_{1,i}$ $i_{}$ $x_{2,i}$ $x_{1,i}$ $\sgn$ $\text{abs}$ 1 125 110 1 15 2 115 122 –1 7 3 130 125 1 5 4 140 120 1 20 5 140 140 0 6 115 124 –1 9 7 140 123 1 17 8 125 137 –1 12 9 140 135 1 5 10 135 145 –1 10
order by absolute difference
 $x_{2,i} - x_{1,i}$ $i_{}$ $x_{2,i}$ $x_{1,i}$ $\sgn$ $\text{abs}$ $R_i$ $\sgn \cdot R_i$ 5 140 140 0 3 130 125 1 5 1.5 1.5 9 140 135 1 5 1.5 1.5 2 115 122 –1 7 3 –3 6 115 124 –1 9 4 –4 10 135 145 –1 10 5 –5 8 125 137 –1 12 6 –6 1 125 110 1 15 7 7 7 140 123 1 17 8 8 4 140 120 1 20 9 9
$sgn$ is the sign function, $\text{abs}$ is the absolute value, and $R_i$ 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.
$N_r = 10 - 1 = 9, W = |1.5+1.5-3-4-5-6+7+8+9| = 9.$
$W < W_{\alpha = 0.05, 9} = 39 \therefore \text{fail to reject } H_0.$

## See also

• Mann-Whitney-Wilcoxon test (the variant for two independent samples)
• Sign test (Like Wilcoxon test, but without the assumption of symmetric distribution of the differences around the median, and without using the magnitude of the difference)

## References

1. ^ a b Lowry, Richard. "Concepts & Applications of Inferential Statistics". Retrieved 24 March 2011.
2. ^ Wilcoxon, Frank (Dec 1945). "Individual comparisons by ranking methods". Biometrics Bulletin 1 (6): 80–83.
3. ^ Siegel, Sidney (1956). Non-parametric statistics for the behavioral sciences. New York: McGraw-Hill. pp. 75–83.
4. ^ Ikewelugo Cyprian Anaene Oyeka (Apr 2012). "Modified Wilcoxon Signed-Rank Test". Open Journal of Statistics: 172–176.