Wilcoxon sign rank test

The Wilcoxon signed-rank test is a non-parametric alternative to the paired Student's t-test. It should be used whenever the assumptions that underlie the t-test cannot be satisfied. The test is named for Frank Wilcoxon (1892–1965) who proposed this, and the rank-sum test, in 1945.

Setup
Supposed 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 $$x_i$$ and second observation be $$y_i$$.

Assumptions

 * 1) Let $$Z_i=Y_i-X_i$$ for 'i=1,...,n'. The differences $$Z_i$$ are assumed to be independent.
 * 2) Each $$Z_i$$ comes from a continuous population (they need not be identical) and is symmetric about a common median $$\theta$$.

Test Procedure
The null hypothesis tested is $$H_0$$: $$\theta=0$$. The Wilcoxon signed rank statistic $$W^+$$ is computed by ordering the absolute values $$|Z_1|$$,...,$$|Z_n|$$, the rank of each ordered $$|Z_i|$$ is given a rank of $$R_i$$. Denote $$\phi_i=I(Z_i>0)$$ where $$I(.)$$ is an indicator function. The Wilcoxon signed ranked statistic $$W^+$$ is defined as,

$$W^+=\sum_{i=1}^n \phi_i R_i$$

It is often used to test difference scores of data collected before and after an experimental manipulation, in which case the central point 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, n, used increases, the distribution of all possible ranks S tends towards the normal distribution, so for an n of greater than 10 this distribution is often used to calculate p.