Computes Wilcoxon rank sum test statistic and P-value for a set of observations against another set, using the given alternative. Alt.less means that sample1 is stochastically less than sample2. Alt.greater means sample1 is stochastically greater than sample2. Alt.twoSided means sample1 is stochastically less than or greater than sample2.

exactThresh is the threshold value of (n1 + n2) at which this function switches from exact to approximate computation of the p-value. Do not set exactThresh to more than 200, as the exact calculation is both very slow and not numerically stable past this point, and the asymptotic calculation is very good for N this large. To disable exact calculation entirely, set exactThresh to 0.

Notes: Exact p-value computation is never used when ties are present in the data, because it is not computationally feasible.

Input ranges for this function must define a length.

This test is also known as the Mann-Whitney U test.

if (
isInputRange!T &&
is(typeof(sample1.front < sample2.front) == bool)
is(CommonType!(ElementType!T, ElementType!U))

Return Value

Type: TestRes

A TestRes containing the W test statistic and the P-value against the given alternative.

References: http://en.wikipedia.org/wiki/Mann%E2%80%93Whitney_U

StackOverflow Question 376003 http://stackoverflow.com/questions/376003

Loughborough University MLSC Statistics 2.3 The Mann-Whitney U Test http://mlsc.lboro.ac.uk/resources/statistics/Mannwhitney.pdf