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 of the null hypothesis that two populations are the same against an alternative hypothesis, especially that a particular population tends to have larger values than the other.
It has greater efficiency than the t-test on non-normal distributions, such as a mixture of normal distributions, and it is nearly as efficient as the t-test on normal distributions.
Contents
- 1 Assumptions and formal statement of hypotheses
- 2 Calculations
- 3 Properties
- 4 Examples
- 4.1 Illustration of calculation methods
- 4.2 Illustration of object of test
- 5 Normal approximation
- 6 Relation to other tests
- 6.1 Comparison to Student's t-test
- 6.2 Area-under-curve (AUC) statistic for ROC curves
- 6.3 Different distributions
- 7 History
- 8 Related test statistics
- 8.1 Kendall's τ
- 8.2 ρ statistic
- 9 Example statement of results
- 10 Implementations
- 11 See also
- 12 Notes
- 13 References
- 14 Further reading
- 15 External links
|
Assumptions and formal statement of hypotheses[edit]
Although Mann and Whitney[1] developed the MWW test under the assumption of continuous responses with the alternative hypothesis being that one distribution is stochastically greater than the other, there are many other ways to formulate the null and alternative hypotheses such that the MWW test will give a valid test.[2]
A very general formulation is to assume that:
- All the observations from both groups are independent of each other,
- The responses are ordinal (i.e. one can at least say, of any two observations, which is the greater),
- The distributions of both groups are equal under the null hypothesis, so that the probability of an observation from one population (X) exceeding an observation from the second population (Y) equals the probability of an observation from Y exceeding an observation from X. That is, there is a symmetry between populations with respect to probability of random drawing of a larger observation.
- Under the alternative hypothesis, the probability of an observation from one population (X) exceeding an observation from the second population (Y) (after exclusion of ties) is not equal to 0.5. The alternative may also be stated in terms of a one-sided test, for example: P(X > Y) + 0.5 P(X = Y) > 0.5.
Under more strict assumptions than those above, e.g., if the responses are assumed to be continuous and the alternative is restricted to a shift in location (i.e. F1(x) = F2(x + δ)), we can interpret a significant MWW test as showing a difference in medians. Under this location shift assumption, we can also interpret the MWW 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.
Calculations[edit]
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 sample sizes above ~20 approximation using the normal distribution is fairly good. Some books tabulate statistics equivalent to U, such as the sum of ranks in one of the samples, rather than U itself.
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.
First, arrange all the observations into a single ranked series. That is, rank all the observations without regard to which sample they are in.
Method one:
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."
- For each observation in sample 1, count the number of observations in sample 2 that have a smaller rank (count a half for any that are equal to it). The sum of these counts is U.
Method two:
For larger samples, a formula can be used:
- Add up the ranks for the observations which came from sample 1. The sum of ranks in sample 2 is now determinate, 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 sample size for sample 1, and R1 is the sum of the ranks in sample 1.
-
- Note that it doesn't matter which of the two samples 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
-
- Knowing that R1 + R2 = N(N + 1)/2 and N = n1 + n2 , and doing some algebra, we find that the sum is
Properties[edit]
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.
Examples[edit]
Illustration of calculation methods[edit]
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:
- 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 is beaten by, getting 0, 5, 5, 5, 5, 5, which means U = 25. Alternatively, we could take each hare in turn, and count the number of tortoises it is beaten by. In this case, we get 1, 1, 1, 1, 1, 6. So U = 6 + 1 + 1 + 1 + 1 + 1 = 11. 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.
Illustration of object of test[edit]
A second example race, with 19 participants of each species, in which the outcomes are as follows:
- H H H H H H H H H T T T T T T T T T T H H H H H H H H H H T T T T T T T T T
The median tortoise here comes in at position 19, and thus actually beats the median hare, which comes in at position 20.
However, the value of U (for hares) is 100
(9 Hares beaten by (x) 0 tortoises) + (10 hares beaten by (x) 10 tortoises) = 0 + 100 = 100
Value of U(for tortoises) is 261
(10 tortoises beaten by 9 hares) + (9 tortoises beaten by 19 hares) = 90 + 171 = 261
Consulting tables, or using the approximation below, shows that this U value gives significant evidence that hares tend to do better than tortoises (p < 0.05, two-tailed). Obviously this is an extreme distribution that would be spotted easily, but in a larger sample something similar could happen without it being so apparent. Notice that the problem here is not that the two distributions of ranks have different variances; they are mirror images of each other, so their variances are the same, but they have very different mean.
Normal approximation[edit]
For large samples, U is approximately normally distributed. In that case, the standardized value
where mU and σU 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. mU and σU are given by
The formula for the standard deviation is more complicated in the presence of tied ranks; the full formula is given in the text books referenced below[citation needed]. However, 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 U1 + U2 = n1 n2, the mean n1 n2/2 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.
Relation to other tests[edit]
Comparison to Student's t-test[edit]
The U test is more widely applicable than independent samples Student's t-test, and the question arises of which should be preferred.
- Ordinal data
- 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.
- Robustness
- As it compares the sums of ranks,[3] the Mann–Whitney test is less likely than the t-test to spuriously indicate significance because of the presence of outliers – i.e. Mann–Whitney is more robust.[clarification needed][citation needed]
- Efficiency
- When normality holds, MWW has an (asymptotic) efficiency of or about 0.95 when compared to the t test.[4] For distributions sufficiently far from normal and for sufficiently large sample sizes, the MWW is considerably more efficient than the t.[5]
Overall, the robustness makes the MWW more widely applicable than the t test, and for large samples from the normal distribution, the efficiency loss compared to the t test is only 5%, so one can recommend MWW as the default test for comparing interval or ordinal measurements with similar distributions.[citation needed]
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.
MWW will give very similar results to performing an ordinary parametric two-sample t test on the rankings of the data.[6]
Area-under-curve (AUC) statistic for ROC curves[edit]
The U statistic is equivalent to the area under the receiver operating characteristic curve that can be readily calculated.[7][8]
-
Because of its probabilistic form, the U statistic can be generalised to a measure of a classifier's separation power for more than two classes:[9]
-
Where c is the number of classes, and the term of considers only the ranking of the items belonging to classes k and l (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. will always be zero but, unlike in the two-class case, generally , which is why the measure sums over all (k, l) pairs, in effect using the average of and .
Different distributions[edit]
If one is only interested in stochastic ordering of the two populations (i.e., the concordance probability P(Y > X)), the U test can be used even if the shapes of the distributions are different. The concordance probability is exactly equal to the area under the receiver operating characteristic curve (ROC) that is often used in the context.[citation needed]
Alternatives[edit]
If one desires a simple shift interpretation, the U test should not be used when the distributions of the two samples are very different, as it can give erroneously significant results.[citation needed] In that situation, the unequal variances version of the t test is likely to give more reliable results, but only if normality holds.[citation needed]
Alternatively, some authors (e.g. Conover[full citation needed]) 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.[citation needed]
History[edit]
The statistic appeared in a 1914 article [10] by the German Gustav Deuchler (with a missing term in the variance).
As a one-sample statistic, the signed rank was proposed by Frank Wilcoxon in 1945,[11] with some discussion of a two-sample variant for equal sample sizes, in a test of significance with a point null-hypothesis against its complementary alternative (that is, equal versus not equal).
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.[1] This article discussed alternative hypotheses, including a stochastic ordering (where the cumulative distribution functions satisfied the pointwise inequality F_X(t) < G_y(t)) ). 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.
Related test statistics[edit]
Kendall's τ[edit]
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).[citation needed]
ρ statistic[edit]
A statistic called ρ that is linearly related to U and widely used in studies of categorization (discrimination learning involving concepts)[citation needed], and elsewhere,[12] 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 P(Y > X) + 0.5 P(Y = X), 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 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.[citation needed].
Example statement of results[edit]
In reporting the results of a Mann–Whitney test, it is important to state:
- A measure of the central tendencies of the two groups (means or medians; since the Mann–Whitney is an ordinal test, medians are usually recommended)
- The value of U
- The sample sizes
- The significance level.
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,
- "Median latencies in groups E and C were 153 and 247 ms; the distributions in the two groups differed significantly (Mann–Whitney U = 10.5, n1 = n2 = 8, P < 0.05 two-tailed)."
A statement that does full justice to the statistical status of the test might run,
- "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.[13] 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] kg. Treatment A decreased weight by HLΔ = 5 kg (0.95 CL [2, 9] kg, 2P = 0.02, ρ = 0.58)."
However it would be rare to find so extended a report in a document whose major topic was not statistical inference.
Implementations[edit]
In many software packages, the Mann–Whitney 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 versions of the following packages:[14]
- R's statistics base-package implements the test
wilcox.test
and in its COIN package.
- SAS implements the test in its PROC NPAR1WAY procedure.
- Stata implements the test in its ranksum command.
See also[edit]
- Kolmogorov–Smirnov test
- Wilcoxon signed-rank test
- Kruskal–Wallis one-way analysis of variance
Notes[edit]
- ^ a b Mann, Henry B.; Whitney, Donald R. (1947). "On a Test of Whether one of Two Random Variables is Stochastically Larger than the Other". Annals of Mathematical Statistics 18 (1): 50–60. doi:10.1214/aoms/1177730491. MR 22058. Zbl 0041.26103.
- ^ Fay, Michael P.; Proschan, Michael A. (2010). "Wilcoxon–Mann–Whitney or t-test? On assumptions for hypothesis tests and multiple interpretations of decision rules". Statistics Surveys 4: 1–39. doi:10.1214/09-SS051. MR 2595125. PMC 2857732. PMID 20414472.
- ^ Motulsky, Harvey J.; Statistics Guide, San Diego, CA: GraphPad Software, 2007, p. 123
- ^ Lehamnn, Erich L.; Elements of Large Sample Theory, Springer, 1999, p. 176
- ^ Conover, William J.; Practical Nonparametric Statistics, John Wiley & Sons, 1980 (2nd Edition), pp. 225–226
- ^ Conover, William J.; Iman, Ronald L. (1981). "Rank Transformations as a Bridge Between Parametric and Nonparametric Statistics". The American Statistician 35 (3): 124–129. doi:10.2307/2683975. JSTOR 2683975.
- ^ Hanley, James A.; McNeil, Barbara J. (1982). "The Meaning and Use of the Area under a Receiver Operating (ROC) Curve Characteristic". Radiology 143 (1): 29–36. PMID 7063747.
- ^ Mason, Simon J.; Graham, Nicholas E. (2002). "Areas beneath the relative operating characteristics (ROC) and relative operating levels (ROL) curves: Statistical significance and interpretation". Quarterly Journal of the Royal Meteorological Society (128): 2145–2166.
- ^ Hand, David J.; Till, Robert J. (2001). "A Simple Generalisation of the Area Under the ROC Curve for Multiple Class Classification Problems". Machine Learning (pdf) 45 (2): 171–186. doi:10.1023/A:1010920819831.
- ^ Kruskal, William H. (September 1957). "Historical Notes on the Wilcoxon Unpaired Two-Sample Test". Journal of the American Statistical Association 52 (279): 356–360.
- ^ Wilcoxon, Frank (1945). "Individual comparisons by ranking methods". Biometrics Bulletin 1 (6): 80–83. doi:10.2307/3001968. JSTOR 3001968.
- ^ Herrnstein, Richard J.; Loveland, Donald H.; Cable, Cynthia (1976). "Natural Concepts in Pigeons". Journal of Experimental Psychology: Animal Behavior Processes 2: 285–302. doi:10.1037/0097-7403.2.4.285.
- ^ Myles Hollander and Douglas A. Wolfe (1999). Nonparametric Statistical Methods (2 ed.). Wiley-Interscience. ISBN 978-0471190455.
- ^
Different Outcomes of the Wilcoxon-Mann-Whitney Test from Different Statistics Packages
Reinhard Bergmann, John Ludbrook and Will P. J. M. Spooren
The American Statistician , Vol. 54, No. 1 (Feb., 2000), pp. 72-77
Published by: American Statistical Association
Article Stable URL: http://www.jstor.org/stable/2685616
References[edit]
- Lehmann, Erich L. (1975); Nonparametrics: Statistical Methods Based on Ranks.
Further reading[edit]
- Hettmansperger, T. P.; McKean, J. W. (1998). Robust nonparametric statistical methods. Kendall's Library of Statistics 5 (First ed., rather than Taylor and Francis (2010) second ed.). London: Edward Arnold. pp. xiv+467. ISBN 0-340-54937-8. MR 1604954.
- Hodges, J. L.; Lehmann, E. L. (1963). "Estimation of location based on ranks". Annals of Mathematical Statistics 34 (2): 598–611. doi:10.1214/aoms/1177704172. JSTOR 2238406. MR 152070. Zbl 0203.21105. PE euclid.aoms/1177704172.
- Lehmann, Erich L. (2006). Nonparametrics: Statistical methods based on ranks. With the special assistance of H. J. M. D'Abrera (Reprinting of 1988 revision of 1975 Holden-Day ed.). New York: Springer. pp. xvi+463. ISBN 978-0-387-35212-1. MR 395032.
- Oja, Hannu (2010). Multivariate nonparametric methods with R: An approach based on spatial signs and ranks. Lecture Notes in Statistics 199. New York: Springer. pp. xiv+232. doi:10.1007/978-1-4419-0468-3. ISBN 978-1-4419-0467-6. MR 2598854.
- Sen, Pranab Kumar (December 1963). "On the estimation of relative potency in dilution(-direct) assays by distribution-free methods". Biometrics 19 (4): 532–552. doi:10.2307/2527532. JSTOR 2527532. Zbl 0119.15604.
External links[edit]
- Table of critical values of U (pdf)
- Interactive calculator for U and its significance
Statistics
|
|
Descriptive statistics
|
|
Continuous data |
Location |
- Mean (Arithmetic, Geometric, Harmonic)
- Median
- Mode
|
|
Dispersion |
- Range
- Standard deviation
- Coefficient of variation
- Percentile
- Interquartile range
|
|
Shape |
- Variance
- Skewness
- Kurtosis
- Moments
- L-moments
|
|
|
Count data |
|
|
Summary tables |
- Grouped data
- Frequency distribution
- Contingency table
|
|
Dependence |
- Pearson product-moment correlation
- Rank correlation (Spearman's rho, Kendall's tau)
- Partial correlation
- Scatter plot
|
|
Statistical graphics |
- Bar chart
- Biplot
- Box plot
- Control chart
- Correlogram
- Forest plot
- Histogram
- Q–Q plot
- Run chart
- Scatter plot
- Stemplot
- Radar chart
|
|
|
|
Data collection
|
|
Designing studies |
- Effect size
- Standard error
- Statistical power
- Sample size determination
|
|
Survey methodology |
- Sampling
- Stratified sampling
- Opinion poll
- Questionnaire
|
|
Controlled experiment |
- Design of experiments
- Randomized experiment
- Random assignment
- Replication
- Blocking
- Factorial experiment
- Optimal design
|
|
Uncontrolled studies |
- Natural experiment
- Quasi-experiment
- Observational study
|
|
|
|
Statistical inference
|
|
Statistical theory |
- Sampling distribution
- Order statistics
- Sufficiency
- Completeness
- Exponential family
- Permutation test (Randomization test)
- Empirical distribution
- Bootstrap
- U statistic
- Efficiency
- Asymptotics
- Robustness
|
|
Frequentist inference |
- Unbiased estimator (Mean unbiased minimum variance, Median unbiased)
- Biased estimators (Maximum likelihood, Method of moments, Minimum distance, Density estimation)
- Confidence interval
- Testing hypotheses
- Power
- Parametric tests (Likelihood-ratio, Wald, Score)
|
|
Specific tests |
- Z (normal)
- Student's t-test
- F
- Chi-squared
- Signed-rank (1-sample, 2-sample, 1-way anova)
- Shapiro–Wilk
- Kolmogorov–Smirnov
|
|
Bayesian inference |
- Bayesian probability
- Prior
- Posterior
- Credible interval
- Bayes factor
- Bayesian estimator
- Maximum posterior estimator
|
|
|
|
Correlation and regression analysis
|
|
Correlation |
- Pearson product–moment correlation
- Partial correlation
- Confounding variable
- Coefficient of determination
|
|
Regression analysis |
- Errors and residuals
- Regression model validation
- Mixed effects models
- Simultaneous equations models
|
|
Linear regression |
- Simple linear regression
- Ordinary least squares
- General linear model
- Bayesian regression
|
|
Non-standard predictors |
- Nonlinear regression
- Nonparametric
- Semiparametric
- Isotonic
- Robust
|
|
Generalized linear model |
- Exponential families
- Logistic (Bernoulli)
- Binomial
- Poisson
|
|
Partition of variance |
- Analysis of variance (ANOVA)
- Analysis of covariance
- Multivariate ANOVA
- Degrees of freedom
|
|
|
|
Categorical, multivariate, time-series, or survival analysis
|
|
Categorical data |
- Cohen's kappa
- Contingency table
- Graphical model
- Log-linear model
- McNemar's test
|
|
Multivariate statistics |
- Multivariate regression
- Principal components
- Factor analysis
- Cluster analysis
- Classification
- Copulas
|
|
Time series analysis |
General |
- Decomposition
- Trend
- Stationarity
- Seasonal adjustment
|
|
Time domain |
- ACF
- PACF
- XCF
- ARMA model
- ARIMA model
- Vector autoregression
|
|
Frequency domain |
- Spectral density estimation
|
|
|
Survival analysis |
- Survival function
- Kaplan–Meier
- Logrank test
- Failure rate
- Proportional hazards models
- Accelerated failure time model
|
|
|
|
Applications
|
|
Biostatistics |
- Bioinformatics
- Clinical trials & studies
- Epidemiology
- Medical statistics
|
|
Engineering statistics |
- Chemometrics
- Methods engineering
- Probabilistic design
- Process & Quality control
- Reliability
- System identification
|
|
Social statistics |
- Actuarial science
- Census
- Crime statistics
- Demography
- Econometrics
- National accounts
- Official statistics
- Population
- Psychometrics
|
|
Spatial statistics |
- Cartography
- Environmental statistics
- Geographic information system
- Geostatistics
- Kriging
|
|
|
|
- Category
- Portal
- Outline
- Index
|
|