Wilcoxon signed-rank test
The Wilcoxon signed-rank test is a non-parametric statistical hypothesis test used when comparing two related samples or repeated measurements on a single sample to assess whether their population mean ranks differ (i.e. it's a paired difference test).
It can be used as an alternative to the paired Student's t-test when the population cannot be assumed to be normally distributed or the data is on the ordinal scale.[1]
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 Siegel (1956)[3] in his influential text book on non-parametric statistics. Siegel used the symbol T for the value defined below as S. In consequence, the test is sometimes referred to as the Wilcoxon T test, and the test statistic is reported as a value of T.
Contents |
[edit] Setup
Suppose we collect 2n observations, two observations of each of the n subjects. Let i denote the particular subject that is being referred to and the first observation measured on subject i be denoted by xi and second observation be yi. For each i in the observations, xi and yi should be paired together.
[edit] Assumptions
Let Zi = Xi – Yi for i = 1, ... , n [4].
- The differences Zi are assumed to be independent.
- Each Zi comes from the same continuous population.
- The values which Xi and Yi represent are ordered (at least the ordinal level of measurement[1]), so the comparisons "greater than", "less than", and "equal to" are useful. X and Y need to be on scales that make differences orderable, which can mean that X and Y are interval scaled.
- If we wish to make an inference about the mean (or about the median) difference, then we assume the distribution of the differences is symmetric. If we only want to test the hypothesis that the probability that the sum of a randomly chosen pair of differences exceeds zero is 0.5 then no distributional assumption is needed.
[edit] Test procedure
The null hypothesis tested is H0: θ = 0.
- Exclude observations with Zi = 0. Let m be the reduced sample size. (But see the note on #Excluding zero differences below.)
- Order the absolute values |Z1|, ..., |Zn| in ascending sequence, and let the rank of each non-zero |Zi| be Ri (the smallest positive |Zi| gets the rank of 1, and a mean rank is assigned to tied scores).
- Denote the positive Zi values with φi = I(Zi > 0), where I(.) is an indicator function: φi = 1 for Zi > 0, otherwise φi = 0.
- The Wilcoxon signed ranked statistic W+ is defined as

- Define W− similarly by summing ranks of the negative differences Zi.
- Calculate S as the smaller of these two rank sums: S = min(W+, W−).
- Find the critical value for the given sample size n (or m?[citation needed]), and the wanted confidence level.
- For samples of a small size the critical value is obtained from a table (which is calculated by considering all possible distributions of ranks to calculate p, the statistical probability of attaining S from a population of scores that is symmetrically distributed around the central point)
- As the number of scores used, n, increases, the distribution of all possible ranks S tends towards the normal distribution. So although for n ≤ 20, exact probabilities would usually be calculated, for n > 20, the normal approximation is used. The recommended cutoff varies from textbook to textbook — here we use 20 although some put it lower (10) or higher (25).
- Compare S to the critical value, and reject H0 if S is less than or is equal to the critical value.
[edit] Confidence interval for the Wilcoxon signed-rank test
A median confidence interval can be constructed based on Wilcoxon signed-rank test for matched pairs.[5] To create the confidence interval, all possible pairs (Xi,Xj) are used to compute the differences Di=Xi-Xj; then, compute all of the averages, υij use:
- υij=(Di+Dj)/2
There would be [n(n-1)/2]+n averages. Then arrange all the averages from smallest to largest, and the median of ordered averages gives a point estimate of the population.
[edit] Example
| Subject (i) | Xi | Yi | Sign of Xi – Yi | Xi – Yi | Absolute Xi – Yi | Rank of Absolute | Signed Rank |
|---|---|---|---|---|---|---|---|
| 1 | 125 | 110 | + | 15 | 15 | 7 | 7 |
| 2 | 115 | 122 | – | –7 | 7 | 3 | –3 |
| 3 | 130 | 125 | + | 5 | 5 | 1.5 | 1.5 |
| 4 | 140 | 120 | + | 20 | 20 | 9 | 9 |
| 5 | 140 | 140 | 0 | 0 | |||
| 6 | 115 | 124 | – | –9 | 9 | 4 | –4 |
| 7 | 140 | 123 | + | 17 | 17 | 8 | 8 |
| 8 | 125 | 137 | – | –12 | 12 | 6 | –6 |
| 9 | 140 | 135 | + | 5 | 5 | 1.5 | 1.5 |
| 10 | 135 | 145 | – | –10 | 10 | 5 | –5 |
- The sign of Xi – Yi is denoted in the Sign column by either (+) or (–). If Xi and Yi are equal, then the value is thrown out.
- The values of Xi – Yi are given in the next two columns.
- The last two columns are the ranks. The absolute rank column has no signs, and the signed rank column gives the ranks along with their signs.
- The data is ranked from the smallest value to the largest value. In the case of a tie, ranks are added together and divided by the number of ties. For example, in this data, there were two instances of the value 5. The ranks corresponding to 5 are 1 and 2. The sum of these ranks is 3. After dividing by the number of ties, you get a mean rank of 1.5, and this value is assigned to both instances of 5.
- The test statistic, W+, is given by the sum of all of the positive values in the Signed Rank column. The test statistic, W–, is given by the sum of all of the negative values in the Signed Rank column. For this example, W+ = 27 and W–=18. The minimum of these is 18.
- Lastly, this test statistic is analyzed using a table of critical values. If the test statistic is less than or equal to the critical value based on the number of observations n, then the null hypothesis is rejected for the alternative hypothesis. Otherwise, the null hypothesis is not rejected. See table here.
In this case the test statistic is W = 18 and the critical value is 8 for a two-tailed p-value of 0.05. The test statistic must be less than this to be significant at this level, so in this case the null hypothesis is not rejected.
[edit] 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)
[edit] References
- ^ a b Lowry, Richard. "Concepts & Applications of Inferential Statistics". http://faculty.vassar.edu/lowry/ch12a.html. Retrieved 24 March 2011.
- ^ Wilcoxon, Frank (Dec 1945). "Individual comparisons by ranking methods". Biometrics Bulletin 1 (6): 80–83. http://sci2s.ugr.es/keel/pdf/algorithm/articulo/wilcoxon1945.pdf.
- ^ Siegel, Sidney (1956). Non-parametric statistics for the behavioral sciences. New York: McGraw-Hill. pp. 75–83. http://books.google.com/books?ei=9cWLTfaTIcmEOs_NuM0L&ct=result&id=ebfRAAAAMAAJ&dq=Wilcoxon+statistics+for+the+behavioral+sciences+Non-parametric&q=Wilcoxon#search_anchor.
- ^ Nonparametric statistical methods (second edition), by Myles Hollander and Douglas A. Wolfe. A wiley interscience publication. 1999. page 36
- ^ Nonparametric Statistics for Non-Statisticians: A Step-by-Step Approach, New Jersey: Wiley,by Corder, G.W. & Foreman, D.I. (2009)
[edit] External links
- 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
[edit] 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_testfunction.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
