Performs a Wilcoxon Matched-Pairs (Signed-Rank) test (S.J. Welham, N.M. Maclaren & H.R. Simpson).

### Option

`PRINT` = string tokens |
Output required (`test` , `ranks` ): `test` gives the relevant test statistics, `ranks` prints out the signed ranks for the vector of differences; default `test` |
---|

### Parameters

`DATA` = variates |
Variates holding the differences between each pair of samples |
---|---|

`RANKS` = variates |
Saves the signed ranks |

`STATISTIC` = scalars |
Saves each test statistic |

`PROBABILITY` = scalars |
Saves the probability for each test statistic |

`SIGN` = scalars |
Scalar to indicate the sign of the total sum of each set of signed ranks: 1 if the sum is positive, 0 otherwise |

### Description

`WILCOXON`

performs a Wilcoxon Matched-Pairs test on a variate holding differences between two paired samples. This is specified using the `DATA`

parameter. The test statistic can be saved using the `STATISTIC`

parameter. The probability can be saved using the `PROBABILITY`

parameter; this is for a two-sided test i.e. no assumption is made about whether the differences should be positive or negative. The `SIGN`

parameter can save an indicator of whether the total sum of signed ranks is positive (`SIGN=1`

) or negative (`SIGN=0`

), and the `RANKS`

parameter can save a variate of the signed ranks of the differences (i.e. of `DATA`

).

Output from the procedure is controlled by the `PRINT`

option: `test`

produces the relevant test statistics, and `ranks`

prints the vector of signed ranks for the data.

Option: `PRINT`

. Parameters: `DATA`

, `RANKS`

, `STATISTIC`

, `PROBABILITY`

, `SIGN`

.

### Method

The Wilcoxon Matched-Pairs test (often also called the Wilcoxon Signed-Ranks test) is a nonparametric test of location in the case of two related samples (e.g. a before-and-after study). The null hypothesis is that two samples arise from exactly the same distribution, with the alternative that the two underlying distributions differ only in location.

The test statistic *WS* is formed from the signed ranks of the differences between each pair of observations and is the smaller in absolute value out of:

1) the sum of positive signed-ranks of the sample, and

2) the sum of the negative signed-ranks.

In this procedure the method used for calculating the test statistic is:

*WS* = *N*×(*N*+1)/4 – modulus(total sum of signed ranks)/2

where *N* is the number of observations. The probability is calculated using the `PRWILCOXON`

procedure.

For further information, see Siegel (1956) pages 75-83.

### Action with `RESTRICT`

If the `DATA`

variate is restricted, the test is calculated only using the units not excluded by the restriction.

### Reference

Siegel, S. (1956). *Nonparametric Statistics for the Behavioural Sciences*. McGraw-Hill, New York.

### See also

Procedure: `PRWILCOXON`

, `MANNWHITNEY`

, `SIGNTEST`

, `TTEST`

.

Commands for: Basic and nonparametric statistics.

### Example

CAPTION 'WILCOXON example',!t(\ '1) Data from Siegel (1956), Nonparametric Statistics, p. 79.',\ 'Social perceptiveness of nursery school and home children.');\ STYLE=meta,plain VARIATE [VALUES=82,69,73,43,58,56,76,85] School & [VALUES=63,42,74,37,51,43,80,82] Home CAPTION !T('A Wilcoxon Signed-Ranks test is used to try',\ 'and detect any differences in the effects of school & home.') WILCOXON [PRINT=test,ranks] School-Home CAPTION !t(\ '2) Data from Siegel (1956), Nonparametric Statistics, p. 82.',\ 'A set of prisoners take decisions which are predicted by the',\ 'experimenter, who wishes to compare the time taken in coming to',\ 'correctly predicted decisions as opposed to unpredicted decisions.',\ 'He has the differences between average times for each type of',\ 'decision for each prisoner.') VARIATE [VALUE=-2, 0, 0, 1, 0, 0, 4, 4, 1, 1, 5, 3, 5, 3,-1, 1,-1, 5, 8, 2,\ 2, 2,-3,-2, 1, 4, 8, 2, 3,-1] Diffs PRINT [ORIENTATION=across] Diffs; FIELD=6; DECIMALS=0 CAPTION !T('A Wilcoxon Signed-Ranks test is used to try',\ 'and detect any differences in times.') WILCOXON [PRINT=test,ranks] Diffs; RANKS=Ranks; STATISTIC=Ws;\ PROBABILITY=Probability; SIGN=Sign PRINT Ws,Probability,Sign & [ORIENTATION=across] Ranks; FIELD=6; DECIMALS=1