naginterfaces.library.nonpar.prob_​mwu_​ties

naginterfaces.library.nonpar.prob_mwu_ties(n1, n2, tail, ranks, u)[source]

prob_mwu_ties calculates the exact tail probability for the Mann–Whitney rank sum test statistic for the case where there are ties in the two samples pooled together.

For full information please refer to the NAG Library document for g08ak

https://support.nag.com/numeric/nl/nagdoc_30.2/flhtml/g08/g08akf.html

Parameters
n1int

The number of non-tied pairs, .

n2int

The size of the second sample, .

tailstr, length 1

Indicates the choice of tail probability, and hence the alternative hypothesis.

A two tailed probability is calculated and the alternative hypothesis is .

An upper tailed probability is calculated and the alternative hypothesis , i.e., the ’s tend to be greater than the ’s.

A lower tailed probability is calculated and the alternative hypothesis , i.e., the ’s tend to be less than the ’s.

ranksfloat, array-like, shape

The ranks of the pooled sample. These ranks are output in the array by test_mwu() and should not be altered in any way if you are using the same , and as used in test_mwu().

ufloat

, the value of the Mann–Whitney rank sum test statistic. This is the statistic returned through the argument by test_mwu().

Returns
pfloat

The tail probability, , as specified by the argument .

Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: , or .

(errno )

On entry, .

Constraint: .

(errno )

On entry, at least one rank, given in , was outside the expected range.

Notes

No equivalent traditional C interface for this routine exists in the NAG Library.

prob_mwu_ties computes the exact tail probability for the Mann–Whitney test statistic (calculated by test_mwu() and returned through the argument ) using a method based on an algorithm developed by Neumann (1988), for the case where there are ties in the pooled sample.

The Mann–Whitney test investigates the difference between two populations defined by the distribution functions and respectively. The data consist of two independent samples of size and , denoted by and , taken from the two populations.

The hypothesis under test, , often called the null hypothesis, is that the two distributions are the same, that is , and this is to be tested against an alternative hypothesis which is

: ; or

: , i.e., the ’s tend to be greater than the ’s; or

: , i.e., the ’s tend to be less than the ’s,

using a two tailed, upper tailed or lower tailed probability respectively. You select the alternative hypothesis by choosing the appropriate tail probability to be computed (see the description of argument in Parameters).

Note that when using this test to test for differences in the distributions one is primarily detecting differences in the location of the two distributions. That is to say, if we reject the null hypothesis in favour of the alternative hypothesis : we have evidence to suggest that the location, of the distribution defined by , is less than the location of the distribution defined by .

prob_mwu_ties returns the exact tail probability, , corresponding to , depending on the choice of alternative hypothesis, .

The value of can be used to perform a significance test on the null hypothesis against the alternative hypothesis . Let be the size of the significance test (that is is the probability of rejecting when is true). If then the null hypothesis is rejected. Typically might be or .

References

Conover, W J, 1980, Practical Nonparametric Statistics, Wiley

Neumann, N, 1988, Some procedures for calculating the distributions of elementary nonparametric teststatistics, Statistical Software Newsletter (14(3)), 120–126

Siegel, S, 1956, Non-parametric Statistics for the Behavioral Sciences, McGraw–Hill