Like the 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.
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 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.
wilcox.test(x,y, paired=TRUE), where x and y are vectors of equal length.