Wilcoxon signed-rank test

From Wikipedia, the free encyclopedia
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-testt-test for matched pairs, or the t-test for dependent samples when the population cannot be assumed to be normally distributed.[1]

History[edit source | editbeta]

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 bySiegel (1956)[3] in his influential text book on non-parametric statistics. Siegel used the symbol T for the value defined below as W. In consequence, the test is sometimes referred to as theWilcoxon T test, and the test statistic is reported as a value of T. Other names may include the "t-test for matched pairs" or the "t-test for dependent samples".

Assumptions[edit source | editbeta]

  1. Data are paired and come from the same population.
  2. Each pair is chosen randomly and independent.
  3. The data are measured at least on an ordinal scale, but need not be normal.
  4. The distribution of the differences is symmetric around the median.[citation needed]

Test procedure[edit source | editbeta]

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 < 10W 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.

Example[edit source | editbeta]

   x_{2,i} - x_{1,i}
i_{}x_{2,i}x_{1,i}\sgn\text{abs}
1125110115
2115122 –17
313012515
4140120120
5140140 0
6115124 –19
7140123117
8125137 –112
914013515
10135145 –110
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
5140140 0  
3130125151.51.5
9140135151.51.5
2115122 –173 –3
6115124 –194 –4
10135145 –1105 –5
8125137 –1126 –6
112511011577
714012311788
414012012099
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[edit source | editbeta]

  • 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[edit source | editbeta]

  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.

External links[edit source | editbeta]

Implementations[edit source | editbeta]

  • 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