Jump to content

Wilcoxon signed-rank test: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
→‎Example: fix in light of comment I just noticed. Please take a look at this if you know this well
J-a-x (talk | contribs)
Line 129: Line 129:
# 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 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 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<sub>+</sub>, is given by the sum of all the values in the Signed Rank column. For this example, W<sub>+</sub> = 27 and W<sub>-</sub>=18. The minimum of these is 18.
# The test statistic, W<sub>+</sub>, is given by the sum of all of the positive values in the Signed Rank column. The test statistic, W<sub>-</sub>, is given by the sum of all of the negative values in the Signed Rank column. For this example, W<sub>+</sub> = 27 and W<sub>-</sub>=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 in favor of the alternative hypothesis. Otherwise, the null is accepted. [http://www.sussex.ac.uk/Users/grahamh/RM1web/WilcoxonTable2005.pdf See table here.]
# 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 in favor of the alternative hypothesis. Otherwise, the null is accepted. [http://www.sussex.ac.uk/Users/grahamh/RM1web/WilcoxonTable2005.pdf See table here.]



Revision as of 05:45, 4 February 2010

The Wilcoxon signed-rank test is a non-parametric statistical hypothesis test for the case of two related samples or repeated measurements on a single sample. It can be used as an alternative to the paired Student's t-test when the population cannot be assumed to be normally distributed. 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).

Like the paired or related sample t-test, the Wilcoxon test involves comparisons of differences between measurements, so it requires that the data are measured at an interval level of measurement. However it does not require assumptions about the form of the distribution of the measurements. It should therefore be used whenever the distributional assumptions that underlie the t-test cannot be satisfied.

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 and second observation be . For each i in the observations, and should be paired together.

Assumptions

  1. Let Zi = Yi – Xi for i = 1, ... , n. The differences Zi are assumed to be independent.
  2. Each Zi comes from a continuous population (they must be identical) and is symmetric about a common median θ.
  3. Xi and Yi are ordinal variables such that comparisons such as greater than, less than and equal to have meaning.

Test procedure

The null hypothesis tested is H0: θ = 0. The Wilcoxon signed rank statistic W+ is computed by ordering the absolute values |Z1|, ..., |Zn|, the rank of each ordered |Zi| is given a rank of Ri. Denote the positive Zi values with φi = I(Zi > 0), where I(.) is an indicator function. The Wilcoxon signed ranked statistic W+ is defined as

It is often used to test the difference between scores of data collected before and after an experimental manipulation, in which case the central point under the null hypothesis would be expected to be zero. Scores exactly equal to the central point are excluded and the absolute values of the deviations from the central point of the remaining scores is ranked such that the smallest deviation has a rank of 1. Tied scores are assigned a mean rank. The sums for the ranks of scores with positive and negative deviations from the central point are then calculated separately. A value S is defined as the smaller of these two rank sums. S is then compared to a table of 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).

The Wilcoxon test was popularised by Siegel (1956) in his influential text book on non-parametric statistics. Siegel used the symbol T for the value defined here 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.

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
  1. 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.
  2. The values of Xi – Yi are given in the next two columns.
  3. 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.
  4. 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.
  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.
  6. 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 in favor of the alternative hypothesis. Otherwise, the null is accepted. 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 can not be rejected.

See also

References

  • Corder, G.W. & Foreman, D.I. (2009) Nonparametric Statistics for Non-Statisticians: A Step-by-Step Approach, New Jersey: Wiley.
  • Siegel, S. (1956). Non-parametric statistics for the behavioral sciences, 75-83 New York: McGraw-Hill.
  • Wilcoxon, F. (1945). Individual comparisons by ranking methods. Biometrics, 1, 80-83.
  • Lowry, Richard (1999-2009) http://faculty.vassar.edu/lowry/ch12a.html

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.