Calculates probabilities for the Wilcoxon signed-rank statistic (D.B. Baird & J.H. Klotz).
||Sizes of the first groups of observations|
||Values of the signed rank statistic|
||Data variate holding differences between each pair of samples (required only if ties are to be allowed for)|
||Cumulative lower probability of
||Cumulative upper probability of
||Probability density of
||Probability densities of 0…
||Set to a positive error code if it has not been possible to calculate the probabilities when there are ties, otherwise 0|
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
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
CUPROBABILITY parameters can specify scalars to save the cumulative lower and upper probabilities, pr(s ≤
SIGNEDRANK) and pr(s >
PROBABILITY can save the probability density at
SIGNEDRANK, pr(s =
LPROBABILITIES can save a variate containing the densities for 0…
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.
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.
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.
Commands for: Basic and nonparametric statistics.
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,Pr,CN,Pr,CN,Pr,CN,Pr;\ DECIMALS=(0,4)3; FIELD=4,7;\ HEADING='','0.005','','0.01','','0.025','','0.05'