The MannâÂÂWhitney test (also called the MannâÂÂWhitneyâÂÂWilcoxon (MWW/MWU), Wilcoxon rank-sum test, or WilcoxonâÂÂMannâÂÂWhitney test) is a nonparametric statistical test of the null hypothesis that randomly selected values X and Y from two populations have the same distribution.
The value of U calculated by the test can be converted to a measure of effect size by dividing it by the maximum value of U, which is the product of the sizes of the two samples being compared. This measure is the probability that the value of a random observation from the higher group will be greater than that of a random observation from the lower group.
Nonparametric tests used on two dependent samples are the sign test and the Wilcoxon signed-rank test.
Henry Mann and Donald Ransom Whitney developed the MannâÂÂWhitney U test under the assumption of continuous responses with the alternative hypothesis being that one distribution is stochastically greater than the other. That is to say that the probability of a random observation from one group being larger than a random observation from the other group is 0.5. There are many other ways to formulate the null and alternative hypotheses such that the MannâÂÂWhitney U test will give a valid test.
A very general formulation is to assume that:
Under the general formulation, the test is only consistent when the following occurs under H<sub>1</sub>:
Under more strict assumptions than the general formulation above, e.g., if the responses are assumed to be continuous and the alternative is restricted to a shift in location, i.e., , we can interpret a significant MannâÂÂWhitney U test as showing a difference in medians. This, however, is an interpretation, and is not the actual hypothesis being tested (see above). It is important to note that this practice relies on strict assumptions about the data distribution. When this assumption does not hold, it is simple to demonstrate that the test produces a statistically significant result when the medians of the two groups are in fact identical. If a test of medians is required, quantile regression explicitly tests this.
Under this location shift assumption, we can also interpret the MannâÂÂWhitney U test as assessing whether the HodgesâÂÂLehmann estimate of the difference in central tendency between the two populations differs from zero. The HodgesâÂÂLehmann estimate for this two-sample problem is the median of all possible differences between an observation in the first sample and an observation in the second sample.
Otherwise, if both the dispersions and shapes of the distribution of both samples differ, the MannâÂÂWhitney U test fails a test of medians. It is possible to show examples where medians are numerically equal while the test rejects the null hypothesis with a small p-value.
The MannâÂÂWhitney U test / Wilcoxon rank-sum test is not the same as the Wilcoxon signed-rank test, although both are nonparametric and involve summation of ranks. The MannâÂÂWhitney U test is applied to independent samples. The Wilcoxon signed-rank test is applied to matched or dependent samples.
Although Mann and Whitney's original paper described the test as one of stochastic superiority â in other words, as a test of whether an observation from one group was likely to be larger than an observation from the other group, the test statistic, U, does not give this probability. This probability can be simply calculated by dividing U by its maximum value, which is the product of the two sample sizes.
Let be group 1, an i.i.d. sample from , and be group 2, an i.i.d. sample from , and let both samples be independent of each other. The corresponding MannâÂÂWhitney U statistic is defined as the smaller of:
with
The U statistic is related to the area under the receiver operating characteristic curve (AUC):
Note that this is the same definition as the common language effect size, i.e. the probability that a classifier will rank a randomly chosen instance from the first group higher than a randomly chosen instance from the second group.
Because of its probabilistic form, the U statistic can be generalized to a measure of a classifier's separation power for more than two classes:
Where c is the number of classes, and the R<sub>k,âÂÂ</sub> term of AUC<sub>k,âÂÂ</sub> considers only the ranking of the items belonging to classes k and â (i.e., items belonging to all other classes are ignored) according to the classifier's estimates of the probability of those items belonging to class k. AUC<sub>k,k</sub> will always be zero but, unlike in the two-class case, generally , which is why the M measure sums over all (k,âÂÂ) pairs, in effect using the average of AUC<sub>k,âÂÂ</sub> and AUC<sub>âÂÂ,k</sub>.
The test involves the calculation of a statistic, usually called U, whose distribution under the null hypothesis is known:
Alternatively, the null distribution can be approximated using permutation tests and Monte Carlo simulations.
Some books tabulate statistics equivalent to U, such as the sum of ranks in one of the samples, rather than U itself.
The MannâÂÂWhitney U test is included in most statistical packages.
It is also easily calculated by hand, especially for small samples. There are multiple ways of doing this.
Method one:
For comparing two small sets of observations, a direct method is quick, and gives insight into the meaning of the U statistic, which corresponds to the number of wins out of all pairwise contests (see the tortoise and hare example under Examples below). For each observation in one set, count the number of times this first value wins over any observations in the other set (the other value loses if this first is larger). Count 0.5 for any ties. The sum of wins and ties is U (i.e.: ) for the first set. U for the other set is the converse (i.e.: ).
Method two:
For larger samples:
The maximum value of U is the product of the sample sizes for the two samples (i.e.: ). In such a case, the "other" U would be 0.
Suppose that Aesop is dissatisfied with his classic experiment in which one tortoise was found to beat one hare in a race, and decides to carry out a significance test to discover whether the results could be extended to tortoises and hares in general. He collects a sample of 6 tortoises and 6 hares, and makes them all run his race at once. The order in which they reach the finishing post (their rank order, from first to last crossing the finish line) is as follows, writing T for a tortoise and H for a hare:
What is the value of U?
In reporting the results of a MannâÂÂWhitney U test, it is important to state:
In practice some of this information may already have been supplied and common sense should be used in deciding whether to repeat it. A typical report might run,
A statement that does full justice to the statistical status of the test might run,
However it would be rare to find such an extensive report in a document whose major topic was not statistical inference.
For large samples, U is approximately normally distributed. In that case, the standardized value
where m<sub>U</sub> and ÃÂ<sub>U</sub> are the mean and standard deviation of U, is approximately a standard normal deviate whose significance can be checked in tables of the normal distribution. m<sub>U</sub> and ÃÂ<sub>U</sub> are given by
The formula for the standard deviation is more complicated in the presence of tied ranks. If there are ties in ranks, ÃÂ should be adjusted as follows:
where the left side is simply the variance and the right side is the adjustment for ties, t<sub>k</sub> is the number of ties for the kth rank, and K is the total number of unique ranks with ties.
A more computationally-efficient form with factored out is
where .
If the number of ties is small (and especially if there are no large tie bands) ties can be ignored when doing calculations by hand. The computer statistical packages will use the correctly adjusted formula as a matter of routine.
Note that since , the mean used in the normal approximation is the mean of the two values of U. Therefore, the absolute value of the z-statistic calculated will be same whichever value of U is used.
It is a widely recommended practice for scientists to report an effect size for an inferential test.
The following measures are equivalent.
One method of reporting the effect size for the MannâÂÂWhitney U test is with f, the common language effect size. As a sample statistic, the common language effect size is computed by forming all possible pairs between the two groups, then finding the proportion of pairs that support a direction (say, that items from group 1 are larger than items from group 2). To illustrate, in a study with a sample of ten hares and ten tortoises, the total number of ordered pairs is ten times ten or 100 pairs of hares and tortoises. Suppose the results show that the hare ran faster than the tortoise in 90 of the 100 sample pairs; in that case, the sample common language effect size is 90%.
The relationship between f and the MannâÂÂWhitney U (specifically ) is as follows:
This is the same as the area under the curve (AUC) for the ROC curve.
A statistic called àthat is linearly related to U and widely used in studies of categorization (discrimination learning involving concepts), and elsewhere, is calculated by dividing U by its maximum value for the given sample sizes, which is simply . àis thus a non-parametric measure of the overlap between two distributions; it can take values between 0 and 1, and it estimates , where X and Y are randomly chosen observations from the two distributions. Both extreme values represent complete separation of the distributions, while a àof 0.5 represents complete overlap. The usefulness of the àstatistic can be seen in the case of the odd example used above, where two distributions that were significantly different on a MannâÂÂWhitney U test nonetheless had nearly identical medians: the àvalue in this case is approximately 0.723 in favour of the hares, correctly reflecting the fact that even though the median tortoise beat the median hare, the hares collectively did better than the tortoises collectively.
A method of reporting the effect size for the MannâÂÂWhitney U test is with a measure of rank correlation known as the rank-biserial correlation. Edward Cureton introduced and named the measure. Like other correlational measures, the rank-biserial correlation can range from minus one to plus one, with a value of zero indicating no relationship.
There is a simple difference formula to compute the rank-biserial correlation from the common language effect size: the correlation is the difference between the proportion of pairs favorable to the hypothesis (f) minus its complement (i.e.: the proportion that is unfavorable (u)). This simple difference formula is just the difference of the common language effect size of each group, and is as follows:
For example, consider the example where hares run faster than tortoises in 90 of 100 pairs. The common language effect size is 90%, so the rank-biserial correlation is 90% minus 10%, and the rank-biserial .
An alternative formula for the rank-biserial can be used to calculate it from the MannâÂÂWhitney U (either or ) and the sample sizes of each group:
This formula is useful when the data are not available, but when there is a published report, because U and the sample sizes are routinely reported. Using the example above with 90 pairs that favor the hares and 10 pairs that favor the tortoise, U<sub>2</sub> is the smaller of the two, so . This formula then gives , which is the same result as with the simple difference formula above.
The MannâÂÂWhitney U test tests a null hypothesis that the probability distribution of a randomly drawn observation from one group is the same as the probability distribution of a randomly drawn observation from the other group against an alternative that those distributions are not equal (see MannâÂÂWhitney U test#Assumptions and formal statement of hypotheses). In contrast, a t-test tests a null hypothesis of equal means in two groups against an alternative of unequal means. Hence, except in special cases, the MannâÂÂWhitney U test and the t-test do not test the same hypotheses and should be compared with this in mind.
The MannâÂÂWhitney U test will give very similar results to performing an ordinary parametric two-sample t-test on the rankings of the data.
The MannâÂÂWhitney U test is not valid for testing the null hypothesis against the alternative hypothesis ), without assuming that the distributions are the same under the null hypothesis (i.e., assuming ). To test between those hypotheses, better tests are available. Among those are the Brunner-Munzel and the FlignerâÂÂPolicello test. Specifically, under the more general null hypothesis , the MannâÂÂWhitney U test can have inflated type I error rates even in large samples (especially if the variances of two populations are unequal and the sample sizes are different), a problem the better alternatives solve. As a result, it has been suggested to use one of the alternatives (specifically the BrunnerâÂÂMunzel test) if it cannot be assumed that the distributions are equal under the null hypothesis.
If one desires a simple shift interpretation, the MannâÂÂWhitney U test should not be used when the distributions of the two samples are very different, as it can give erroneous interpretation of significant results. In that situation, the unequal variances version of the t-test may give more reliable results.
Similarly, some authors () suggest transforming the data to ranks (if they are not already ranks) and then performing the t-test on the transformed data, the version of the t-test used depending on whether or not the population variances are suspected to be different. Rank transformations do not preserve variances, but variances are recomputed from samples after rank transformations.
The BrownâÂÂForsythe test has been suggested as an appropriate non-parametric equivalent to the F-test for equal variances.
A more powerful test is the Brunner-Munzel test, outperforming the MannâÂÂWhitney U test in case of violated assumption of exchangeability.
The MannâÂÂWhitney U test is a special case of the proportional odds model, allowing for covariate-adjustment.
See also KolmogorovâÂÂSmirnov test.
The MannâÂÂWhitney U test is related to a number of other non-parametric statistical procedures. For example, it is equivalent to Kendall's tau correlation coefficient if one of the variables is binary (that is, it can only take two values).
In many software packages, the MannâÂÂWhitney U test (of the hypothesis of equal distributions against appropriate alternatives) has been poorly documented. Some packages incorrectly treat ties or fail to document asymptotic techniques (e.g., correction for continuity). A 2000 review discussed some of the following packages:
The statistic appeared in a 1914 article by the German Gustav Deuchler (with a missing term in the variance).
In a single paper in 1945, Frank Wilcoxon proposed both the one-sample signed rank and the two-sample rank sum test, in a test of significance with a point null-hypothesis against its complementary alternative (that is, equal versus not equal). However, he only tabulated a few points for the equal-sample size case in that paper (though in a later paper he gave larger tables).
A thorough analysis of the statistic, which included a recurrence allowing the computation of tail probabilities for arbitrary sample sizes and tables for sample sizes of eight or less appeared in the article by Henry Mann and his student Donald Ransom Whitney in 1947. This article discussed alternative hypotheses, including a stochastic ordering (where the cumulative distribution functions satisfied the pointwise inequality ). This paper also computed the first four moments and established the limiting normality of the statistic under the null hypothesis, so establishing that it is asymptotically distribution-free.