The Wilcoxon Matched-Pairs Signed-Ranks Test

Example:
W+ = 5, W- = 40, N = 9, p <= 0

The observation pairs (either a pair each line or the difference itself)

Characteristics:
A most usefull test to see whether the members of a pair differ in size. It resembles the Sign-Test in scope, but it is much more sensitive. In fact, for large numbers it is almost as sensitive as the Student t-test. For small numbers with unknown distributions this test is even more sensitive than the Student t-test.
As it is only on rare occasions that we do know that values are Normal distributed, this test is to be preferred over the Student t-test.

H0:
The difference (d = x - y) between the members of each pair (x, y) has median value zero. To be complete, x an y have identical distributions.

Assumptions:
The distribution of the difference (d) between the values within each pair (x, y) must be symmetrical, the median difference must be identical to the mean difference.
As members of a pair are assumed to have identical distributions, their differences (under H0) should always have a symmetrical distribution, so this assumption is not very restrictive.

Scale:
Between ordinal and interval (also called an ordered metric scale). It must be possible to rank the differences.

Procedure:
Rank the differences without regard to the sign of the difference (i.e., rank order the absolute differences). Ignore all zero differences (i.e., pairs with equal members, x=y). Affix the original signs to the rank numbers. All pairs with equal absolute differences (ties) get the same rank: all are ranked with the mean of the rank numbers that would have been assigned if they would have been different.
Sum all positve ranks (W+) and all negative ranks (W-) and determine the total number of pairs (N).

Level of Significance:
The level of significance is calculated by dividing the number of all distributions of signs over the ranks that have a SUM(+ranks) <= W+ (if W+ < W-) by 2**N (i.e., the total number of possible distributions of signs).
These values are tabulated and the level of significance can be looked up.

Approximation:
If N > 15, then
Z = (W - 0.5 - N * ( N + 1 ) / 4 ) / sqrt( N* ( N + 1 ) * ( 2 * N + 1 ) / 24 )
has an approximate Standard Normal distribution with W the larger of W+ and W-.

Remarks:
It is not quite clear why this test is so impopular. It could be due to the fact that ranking the differences (and calculating the tables) cannot be done with a desk calculator or be programmed in C easily. When this is not a problem, this test should realy be preferred over the Student t-test (at least when N < 50). The Student t-test is much too vulnerable to deviations from the normal distribution.
Note that the Wilcoxon Matched-Pairs Signed-Ranks Test uses the sizes of the differences. The result can differ from that of the Sign-test, which uses the number of + and - signs of the differences.
For N <= 20, exact probabilities are calculated, for N > 20, the Normal approximation is used. A perl script of the test is available here. A minimalist Windows version (with dosperl interpreter) is available here (<500 kB).