Mann-Whitney U
From Wikipedia, the free encyclopedia
In statistics, the Mann-Whitney U test (also called the Mann-Whitney-Wilcoxon (MWW), Wilcoxon rank-sum test, or Wilcoxon-Mann-Whitney test) is a non-parametric test for assessing whether two samples of observations come from the same distribution. The null hypothesis is that the two samples are drawn from a single population, and therefore that their probability distributions are equal. It requires the two samples to be independent, and the observations to be ordinal or continuous measurements, i.e. one can at least say, of any two observations, which is the greater. In a less general formulation, the Wilcoxon-Mann-Whitney two-sample test may be thought of as testing the null hypothesis that the probability of an observation from one population exceeding an observation from the second population is 0.5. This formulation requires the additional assumption that the distributions of the two populations are identical except for possibly a shift (i.e. f1(x) = f2(x + δ) ). Another alternative interpretation is that the test assesses whether the Hodges-Lehmann estimate of the difference in central tendency between the two populations is 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. It is commonly thought that the MWW test tests for differences in medians but this is not strictly true.
It is one of the best-known non-parametric significance tests. It was proposed initially by Wilcoxon (1945), for equal sample sizes, and extended to arbitrary sample sizes and in other ways by Mann and Whitney (1947). MWW is virtually identical to performing an ordinary parametric two-sample t test on the data after ranking over the combined samples.
Contents |
[edit] Calculations
The test involves the calculation of a statistic, usually called U, whose distribution under the null hypothesis is known. In the case of small samples, the distribution is tabulated, but for samples above about 20 there is a good approximation using the normal distribution. Some books tabulate statistics equivalent to U, such as the sum of ranks in one of the samples.
The U test is included in most modern statistical packages. It is also easily calculated by hand, especially for small samples. There are two ways of doing this.
For small samples a direct method is recommended. It is very quick, and gives an insight into the meaning of the U statistic.
- Choose the sample for which the ranks seem to be smaller (The only reason to do this is to make computation easier). Call this "sample 1," and call the other sample "sample 2."
- Taking each observation in sample 2, count the number of observations in sample 1 that are smaller than it (count a half for any that are equal to it).
- The total of these counts is U.
For larger samples, a formula can be used:
- Arrange all the observations into a single ranked series. That is, rank all the observations without regard to which sample they are in.
- Add up the ranks for the observations which came from sample 1. The sum of ranks in sample 2 follows by calculation, since the sum of all the ranks equals N(N + 1)/2 where N is the total number of observations.
- "U" is then given by:
-
- where n1 is the two sample size for sample 1, and R1 is the sum of the ranks in sample 1.
-
- Note that there is no specification as to which sample is considered sample 1. An equally valid formula for U is
- Note that there is no specification as to which sample is considered sample 1. An equally valid formula for U is
-
- The smaller value of U1 and U2 is the one used when consulting significance tables. The sum of the two values is given by
- The smaller value of U1 and U2 is the one used when consulting significance tables. The sum of the two values is given by
-
- Knowing that R1 + R2 = N(N + 1)/2 and N = n1 + n2 , and doing some algebra, we find that the sum is
- Knowing that R1 + R2 = N(N + 1)/2 and N = n1 + n2 , and doing some algebra, we find that the sum is
The maximum value of U is the product of the sample sizes for the two samples. In such a case, the "other" U would be 0.
[edit] Example
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. The order in which they reach the finishing post (their rank order) is as follows, writing T for a tortoise and H for a hare:
- T H H H H H T T T T T H
What is the value of U?
- Using the direct method, we take each tortoise in turn, and count the number of hares it beats, getting 6, 1, 1, 1, 1, 1. So U = 6 + 1 + 1 + 1 + 1 + 1 = 11. Alternatively, we could take each hare in turn, and count the number of tortoises it beats. In this case, we get 5, 5, 5, 5, 5, 0, which means U = 25. Note that the sum of these two values for "U" is 36, which is 6 × 6.
- Using the indirect method:
-
- the sum of the ranks achieved by the tortoises is 1 + 7 + 8 + 9 + 10 + 11 = 46.
- Therefore U = 46 − 6×7/2 = 46 − 21 = 25.
- the sum of the ranks achieved by the hares is 2 + 3 + 4 + 5 + 6 + 12 = 32, leading to U = 32 - 21 = 11.
[edit] Approximation
For large samples, the normal approximation:
can be used, where z is a standard normal deviate whose significance can be checked in tables of the normal distribution. mU and σU are the mean and standard deviation of U if the null hypothesis is true, and are given by
All the formulae here are made more complicated in the presence of tied ranks, but if the number of these is small (and especially if there are no large tie bands) these can be ignored when doing calculations by hand. The computer statistical packages will use them as a matter of routine.
Note that since U1 + U2 = n1 n2, the mean n1 n2/2 used in the normal approximation is the mean of the two values of U. Therefore, you can use U and get the same result, the only difference being between a left-tailed test and a right-tailed test.
[edit] Relation to other tests
The U test is useful in the same situations as the independent samples Student's t-test, and the question arises of which should be preferred. U remains the logical choice when the data are ordinal but not interval scaled, so that the spacing between adjacent values cannot be assumed to be constant. It is much less likely than the t test to give a spuriously significant result because of one or two outliers. When normality holds, MWW has a Pitman efficiency of or about 0.95 when compared to the t test. For distributions sufficiently far from normal and for sufficiently large sample sizes, the MWW can be considerably more efficient than the t. For large samples and the normal, the efficiency loss is only 5%, maybe a small price to pay so one could recommend MWW as the default test for comparing interval or ordinal measurements. The relation between efficiency and power in concrete situations isn't trivial though. For small sample sizes one should investigate the power of the MWW vs t.
On the other hand , the U test is often recommended for situations where the distributions of the two samples are very different. This is an error: it tests whether the two samples come from a common distribution, and Monte Carlo methods have shown that it is capable of giving erroneously significant results in some situations where samples are drawn from distributions with the same mean and different variances. In that situation, the version of the t test that allows for the samples to come from populations of different variance is likely to give more reliable results, if normality holds. Indeed, as an alternative to the U test, some authors (e.g. Conover) 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. The Brown-Forsythe test has been suggested as an appropriate non-parametric equivalent to the F test for equal variances.
The U test is related to a number of other non-parametric statistical procedures. For example, it is equivalent to Kendall's τ correlation coefficient if one of the variables is binary (that is, it can only take two values).
A statistic called ρ that is linearly related to U and widely used in studies of categorization (discrimination learning) is calculated by dividing U by its maximum value for the given sample sizes, which is simply n1 × n2. ρ is thus a non-parametric measure of the overlap between two distributions; it can take values between 0 and 1, and it is an estimate of , 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. ρ is also known as the area under the receiver operating characteristic (ROC) curve.
[edit] Example statement of results
Outcomes of the two treatments were compared using the Wilcoxon-Mann-Whitney two-sample rank-sum test. The treatment effect (difference between treatments) was quantified using the Hodges-Lehmann (HL) estimator, which is consistent with the Wilcoxon test (ref. 5 below). This estimator (HLΔ) is the median of all possible differences in outcomes between a subject in group B and a subject in group A. A non-parametric 0.95 confidence interval for HLΔ accompanies these estimates as does ρ, an estimate of the probability that a randomly chosen subject from population B has a higher weight than a randomly chosen subject from population A.
The median [quartiles] weight for subjects on treatment A and B respectively are 147 [121, 177] and 151 [130, 180] pounds. Treatment A decreased weight by HLΔ = 5 lbs. (0.95 CL [2, 9] lbs., 2P = 0.02, ρ = 0.58).
[edit] See also
[edit] References
- Table of critical values of the Mann-Whitney U distribution (pdf)
- Conover, W. J. (1998). Practical Nonparametric Statistics (3rd Ed.)
- Mann, H. B., & Whitney, D. R. (1947). "On a test of whether one of two random variables is stochastically larger than the other". Annals of Mathematical Statistics, 18, 50-60.
- Wilcoxon, F. (1945). "Individual comparisons by ranking methods". Biometrics Bulletin, 1, 80-83.
- Hollander, M. and Wolfe, D. A. (1999). Nonparametric Statistical Methods (2nd Ed.).
- Lehmann, E. L. (1975). NONPARAMETRICS: Statistical Methods Based On Ranks.