Calculates probabilities for the Wilcoxon signed-rank statistic (D.B. Baird & J.H. Klotz).

### No options

### Parameters

`N` = scalars |
Sizes of the first groups of observations |
---|---|

`SIGNEDRANK` = scalars |
Values of the signed rank statistic |

`DATA` = variates |
Data variate holding differences between each pair of samples (required only if ties are to be allowed for) |

`CLPROBABILITY` = scalars |
Cumulative lower probability of `SIGNEDRANK` |

`CUPROBABILITY` = scalars |
Cumulative upper probability of `SIGNEDRANK` |

`PROBABILITY` = scalars |
Probability density of `SIGNEDRANK` |

`LPROBABILITIES` = variates |
Probability densities of 0…`SIGNEDRANK` |

`EXIT` = scalars |
Set to a positive error code if it has not been possible to calculate the probabilities when there are ties, otherwise 0 |

### Description

`PRWILCOXON`

calculates various probabilities associated with the Wilcoxon signed-rank statistic (or matched-pairs statistic). This statistic arises from the Wilcoxon test, which can be used to give a nonparametric assessment of whether paired samples arise from the same probability distribution, or of whether a single sample has a given median. The Wilcoxon test operates on a variate of differences between paired samples. It calculates the ranks of the absolute values of the differences, and then the sum of the ranks for the negative and for the positive differences. The statistic is the smaller of these two sums. In Genstat, this can be calculated by the `WILCOXON`

procedure (which calls `PRWILCOXON`

to obtain the required probability values). `PRWILCOXON`

works on the sum of the ranks of the positive differences, which takes values from 0 to `N`

×(`N`

+1)/2.

The number of sample pairs of observations is specified by the `N`

parameter, and the `SIGNEDRANK`

parameter specifies the value of the signed rank statistic for which the probabilities are required. If there are ties in the data, you should also supply the original data variate, using the `DATA`

parameter. The `CLPROBABILITY`

and `CUPROBABILITY`

parameters can specify scalars to save the cumulative lower and upper probabilities, pr(*s* ≤ `SIGNEDRANK`

) and pr(*s* > `SIGNEDRANK`

) respectively. `PROBABILITY`

can save the probability density at `SIGNEDRANK`

, pr(*s* = `SIGNEDRANK`

), and `LPROBABILITIES`

can save a variate containing the densities for 0…`SIGNEDRANK`

.

The probabilities are exact for values of `N`

up to 100, and also for values of `N`

between 100 and 200 provided `SIGNEDRANK`

is less than 10001.

Options: none.

Parameters: `N`

, `SIGNEDRANK`

, `DATA`

, `CLPROBABILITY`

, `CUPROBABILITY`

, `PROBABILITY`

, `LPROBABILITIES`

, `EXIT`

.

### Method

The procedure calculates the coefficents of the generating function for the Signed Rank statistic under the null hypothesis using recurrence functions (See van de Weil *et al*. 1999). The central limit theorem is used when `N`

exceeds 200, and a Normal approximation of the CDF is returned. A separate program, that uses the method of Klotz & Cheung (1995), is called through `PASS`

when there are ties. This may not be feasible in every Genstat implementation.

### References

van de Wiel, M.A., Di Bucchianico, A. & van de Laan, P. (1999). Symbolic computation and exact distributions of nonparametric test statistics. *The Statistician*, 48, 507-516.

Klotz, J.H. & Cheung, Y.K. (1995). The Mann Whitney Wilcoxon distribution using linked lists. *Statistica Sinica*, 7, 805-813.

### See also

Procedure: `WILCOXON`

.

Commands for: Basic and nonparametric statistics.

### Example

CAPTION 'PRWILCOXON example',\ !t('Calculate the Table 2.1 of Sen & Krishnaiah (1984),',\ 'Handbook of Statistics, Volume 4, Chapter 37, p. 939.',\ 'Note: the entry for N=6, p=0.05 is incorrect in Table 2.1.');\ STYLE=meta,plain VARIATE [VALUES=0.005,0.01,0.025,0.05] PLevel; DECIMALS=3 & [VALUES=5...35] N; DECIMALS=0 & [NVALUES=N] Pr[1,2,3,4] & [NVALUES=N] CN[1,2,3,4] POINTER [NVALUES=NVALUES(PLevel)] Pos FOR [INDEX=i] n = #N CALCULATE umax = n*(n + 1)/2 PRWILCOXON n; SIGNEDRANK=umax; LPROBABILITIES=lpr CALCULATE clpr = CUMULATE(lpr) & CN[]$[i] = SUM(clpr < #PLevel) - 1 & Pos[] = CN[]$[i] + 1 + (CN[]$[i] < 0) & Pr[]$[i] = clpr$[Pos[]] & Pr[]$[i] = MVINSERT(Pr[]$[i];CN[]$[i] < 0) & CN[]$[i] = MVINSERT(CN[]$[i];CN[]$[i] < 0) DELETE [Redefine=yes] lpr,clpr ENDFOR PRINT [MISSING=' '] CN[1],Pr[1],CN[2],Pr[2],CN[3],Pr[3],CN[4],Pr[4];\ DECIMALS=(0,4)3; FIELD=4,7;\ HEADING='','0.005','','0.01','','0.025','','0.05'