1. Home
2. PRMANNWHITNEYU procedure

# PRMANNWHITNEYU procedure

Calculates probabilities for the Mann-Whitney U statistic (D.B. Baird & J.H. Klotz).

### Parameters

`N1` = scalars Sizes of the first groups of observations Sizes of the second groups of observations Values of the U statistic Number of tied observations; default 0 Cumulative lower probability of `U` Cumulative upper probability of `U` Probability density of `U` Probability densities of 0…`U` Set to 1 if it has not been possible to calculate the probabilities when there are ties, otherwise 0

### Description

`PRMANNWHITNEYU` calculates various probabilities for the Mann-Whitney U statistic. This statistic arises from the Mann-Whitney U test, which can be used to give a nonparametric assessment as to whether two samples arise from the same probability distribution. If the samples are {xi: i=1…n1} and {yj: j=1…n2}, then the Mann-Whitney U statistic is defined as the number of pairs (xi, yj) with xi < yj. In Genstat, U can be calculated by the `MANNWHITNEY` procedure (which calls `PRMANNWHITNEYU` to obtain the required probability values).

The number of samples in the two sets of observations are specified by the `N1` and `N2` parameters, respectively. The `U` parameter specifies the value of the U statistic for which the probabilities are required, and the `TIES` parameter supplies the number of tied observations (if any). `PRMANNWHITNEY` may not be able to calculate the probabilities in every Genstat implementation when there are ties, and so there is also a parameter `EXIT` that you can set to check whether there have been problems (if the calculation has been successful `EXIT`=0, otherwise `EXIT`=1). The `CLPROBABILITY` and `CUPROBABILITY` parameters can specify scalars to save the cumulative lower and upper probabilities, pr(u ≤ U) and pr(u > U) respectively. `PROBABILITY` can save the probability density at U, pr(u = U), and `LPROBABILITIES` can save a variate containing the densities for 0…U.

Options: none.

Parameters: `N1`, `N2`, `U`, `TIES`, `CLPROBABILITY`, `CUPROBABILITY`, `PROBABILITY`, `LPROBABILITIES`, `EXIT`.

### Method

The procedure calculates the coefficents of the generating function for the Mann-Whitney statistic under the null hypothesis using recurrence functions. The central limit theorem is used when the smaller of `N1` and `N2` exceeds 50, and a Normal approximation of the CDF is returned. (See Harding 1983). A separate program, that uses the method of Klotz & Cheung (1995), is called using `PASS` when there are ties. This may not be feasible in every Genstat implementation.

Harding, E.F. (1983) An efficient, minimal-storage procedure for calculating the Mann-Whitney U, Generalised U and similar distributions. Applied Statistics, 33, 1-6.

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

Procedure: `MANNWHITNEY`.

Commands for: Basic and nonparametric statistics.

### Example

```CAPTION     'PRMANNWHITNEYU example',\
!t('Calculate the first part of Table J of Seigel (1956),',\
'Nonparametric Statistics for the Behavioural Sciences.');\
STYLE=meta,plain
VARIATE     [VALUES=0...5] U; DECIMALS=0
&           [NVALUES=U; VALUES=6(*)] Pr_N1[1,2,3]
FOR n1=1,2,3; umax=2,3,5
CALCULATE nu = umax + 1
PRMANNWHITNEYU #nu(n1); N2=3; U=0...umax; CLPROBABILITY=clpr[0...umax]
CALCULATE ELEMENTS(#nu(Pr_N1[n1]); 1...nu) = clpr[0...umax]
ENDFOR
PRINT       [MISSING=' '] Pr_N1[]; DECIMALS=3
```