Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Mann–Whitney U test
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{italic title|string=U}} {{short description|Nonparametric test of the null hypothesis}} {{redirect|Wilcoxon rank-sum test|Wilcoxon signed-rank test|Wilcoxon signed-rank test}} The '''Mann–Whitney <math>U</math> test''' (also called the '''Mann–Whitney–Wilcoxon''' ('''MWW/MWU'''), '''Wilcoxon rank-sum test''', or '''Wilcoxon–Mann–Whitney test''') is a [[nonparametric statistics|nonparametric]] [[statistical test]] of the [[null hypothesis]] that randomly selected values ''X'' and ''Y'' from two populations have the same distribution. Nonparametric tests used on two ''dependent'' samples are the [[sign test]] and the [[Wilcoxon signed-rank test]]. ==Assumptions and formal statement of hypotheses== Although [[Henry Mann]] and Donald Ransom Whitney<ref name="mannwhitney1947" /> developed the Mann–Whitney ''U'' test under the assumption of [[Continuous probability distribution|continuous]] responses with the [[alternative hypothesis]] being that one distribution is [[stochastic ordering|stochastically greater]] than the other, there are many other ways to formulate the [[null hypothesis|null]] and alternative hypotheses such that the Mann–Whitney ''U'' test will give a valid test.<ref name="FayProschan2010">{{cite journal |last1=Fay |first1=Michael P. |last2=Proschan |first2=Michael A. |journal=[[Statistics Surveys]] |year=2010 |pages=1–39 |volume=4 |doi=10.1214/09-SS051 |title=Wilcoxon–Mann–Whitney or ''t''-test? On assumptions for hypothesis tests and multiple interpretations of decision rules |pmc=2857732 |mr=2595125 |pmid=20414472 }}</ref> A very general formulation is to assume that: # All the observations from both groups are [[statistical independence|independent]] of each other, # The responses are at least [[ordinal measurement|ordinal]] (i.e., one can at least say, of any two observations, which is the greater), # Under the null hypothesis ''H''<sub>0</sub>, the distributions of both populations are identical.<ref>[https://www.jstor.org/stable/2283092], See Table 2.1 of Pratt (1964) "Robustness of Some Procedures for the Two-Sample Location Problem." ''Journal of the American Statistical Association.'' 59 (307): 655–680. If the two distributions are normal with the same mean but different variances, then Pr[''X'' > ''Y''] = Pr[''Y'' < ''X''] but the size of the Mann–Whitney test can be larger than the nominal level. So we cannot define the null hypothesis as Pr[''X'' > ''Y''] = Pr[''Y'' < ''X''] and get a valid test.</ref> # The alternative hypothesis ''H''<sub>1</sub> is that the distributions are not identical. Under the general formulation, the test is only [[Consistency (statistics)#Tests|consistent]] when the following occurs under ''H''<sub>1</sub>: # The probability of an observation from population ''X'' exceeding an observation from population ''Y'' is different (larger, or smaller) than the probability of an observation from ''Y'' exceeding an observation from ''X''; i.e., {{math|1=P(''X'' > ''Y'') ≠ P(''Y'' > ''X'')}} or {{math|1=P(''X'' > ''Y'') + 0.5 · P(''X'' = ''Y'') ≠ 0.5}}. 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., {{math|1=''F''<sub>1</sub>(''x'') = ''F''<sub>2</sub>(''x'' + ''δ'')}}, we can interpret a significant Mann–Whitney ''U'' test as showing a difference in medians. 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.<ref>{{cite journal |last1=Divine |first1=George W. |last2=Norton |first2=H. James |last3=Barón |first3=Anna E. |last4=Juarez-Colunga |first4=Elizabeth |title=The Wilcoxon–Mann–Whitney Procedure Fails as a Test of Medians |journal=The American Statistician |date=2018 |volume=72 |issue=3 |pages=278–286 |doi=10.1080/00031305.2017.1305291 |doi-access=free }}</ref><ref>{{cite journal |last1=Conroy |first1=Ronán |title=What Hypotheses do "Nonparametric" Two-Group Tests Actually Test? |journal=Stata Journal |date=2012 |volume=12 |issue=2 |pages=182–190 |doi=10.1177/1536867X1201200202 |s2cid=118445807 |url=https://www.researchgate.net/publication/279580873 |access-date=24 May 2021|doi-access=free }}</ref><ref>{{cite journal |last1=Hart |first1=Anna |title=Mann–Whitney test is not just a test of medians: differences in spread can be important |journal=BMJ |date=2001 |volume=323 |issue=7309 |pages=391–393 |doi=10.1136/bmj.323.7309.391 |doi-access=free |pmid=11509435 |pmc=1120984 }}</ref> The Mann–Whitney ''U'' test / Wilcoxon rank-sum test is not the same as the [[Wilcoxon signed-rank test|Wilcoxon ''signed''-rank test]], although both are nonparametric and involve summation of [[Ranking (statistics)|ranks]]. The Mann–Whitney ''U'' test is applied to independent samples. The Wilcoxon signed-rank test is applied to matched or dependent samples. ==U statistic == Let <math>X_1,\ldots, X_{n_1}</math> be group 1, an [[Independent and identically distributed random variables|i.i.d. sample]] from <math>X</math>, and <math>Y_1,\ldots, Y_{n_2}</math> be group 2, an i.i.d. sample from <math>Y</math>, and let both samples be independent of each other. The corresponding ''Mann–Whitney [[U statistic]]'' is defined as the smaller of: :<math>U_1 = n_1 n_2 + \tfrac{n_1(n_1 + 1)}{2} - R_1, U_2 = n_1 n_2 + \tfrac{n_2(n_2 + 1)}{2} - R_2</math> with :<math>R_1, R_2 </math> being the sums of the ranks in groups 1 and 2, after ranking all samples from both groups such that the smallest value obtains rank 1 and the largest rank <math>n_1+n_2</math>. <ref>[https://sphweb.bumc.bu.edu/otlt/mph-modules/bs/bs704_nonparametric/bs704_nonparametric4.html Boston University (SPH), 2017]</ref> === Area-under-curve (AUC) statistic for ROC curves === The ''U'' statistic is related to the '''area under the [[receiver operating characteristic]] curve''' ([[Receiver operating characteristic#Area under the curve|AUC]]):<ref>{{cite journal | vauthors=((Mason, S. J.)), ((Graham, N. E.)) | journal=Quarterly Journal of the Royal Meteorological Society | title=Areas beneath the relative operating characteristics (ROC) and relative operating levels (ROL) curves: Statistical significance and interpretation | volume=128 | issue=584 | pages=2145–2166 | date= 2002 | issn=1477-870X | doi=10.1256/003590002320603584}}</ref> :<math>\mathrm{AUC}_1 = {U_1 \over n_1n_2}</math> 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.<ref name="fawcett">Fawcett, Tom (2006); ''[https://www.math.ucdavis.edu/~saito/data/roc/fawcett-roc.pdf An introduction to ROC analysis]'', Pattern Recognition Letters, 27, 861–874.</ref> 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:<ref>{{cite journal |last1=Hand |first1=David J. |last2=Till |first2=Robert J. |year=2001 |title=A Simple Generalisation of the Area Under the ROC Curve for Multiple Class Classification Problems |journal=Machine Learning |volume=45 |pages=171–186 |doi=10.1023/A:1010920819831 |doi-access=free |number=2}}</ref> :<math>M = {1 \over c(c-1)} \sum \mathrm{AUC}_{k,\ell}</math> 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 {{math|1=AUC<sub>''k'',''ℓ''</sub> ≠ AUC<sub>''ℓ'',''k''</sub>}}, 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>. ==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 * For sample sizes above ~20, approximation using the [[normal distribution]] is fairly good. Alternatively, the null distribution can be approximated using [[permutation test]]s 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 [[List of statistical packages|statistical packages]]. It is also easily calculated by hand, especially for small samples. There are two 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.: <math>U_1</math>) for the first set. ''U'' for the other set is the converse (i.e.: <math>U_2</math>). '''Method two:''' For larger samples: # Assign numeric ranks to all the observations (put the observations from both groups to one set), beginning with 1 for the smallest value. Where there are groups of tied values, assign a rank equal to the midpoint of unadjusted rankings (e.g., the ranks of {{math|(3, 5, 5, 5, 5, 8)}} are {{math|(1, 3.5, 3.5, 3.5, 3.5, 6)}}, where the unadjusted ranks would be {{math|(1, 2, 3, 4, 5, 6)}}). # Now, add up the ranks for the observations which came from sample 1. The sum of ranks in sample 2 is now determined, since the sum of all the ranks equals {{math|''N''(''N'' + 1)/2}} where ''N'' is the total number of observations. # ''U'' is then given by:<ref>{{cite book|last=Zar|first=Jerrold H.|title=Biostatistical Analysis|year=1998|publisher=Prentice Hall International, INC.|location=New Jersey|isbn=978-0-13-082390-8|page=147}}</ref> :::<math>U_1=R_1 - {n_1(n_1+1) \over 2} \,\!</math> ::where ''n''<sub>1</sub> is the sample size for sample 1, and ''R''<sub>1</sub> 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 :::<math>U_2= R_2 - {n_2(n_2+1) \over 2} \,\!</math> ::The smaller value of ''U''<sub>1</sub> and ''U''<sub>2</sub> is the one used when consulting significance tables. The sum of the two values is given by :::<math>U_1 + U_2 = R_1 - {n_1(n_1+1) \over 2} + R_2 - {n_2(n_2+1) \over 2}. \,\!</math> :: Knowing that {{math|1=''R''<sub>1</sub> + ''R''<sub>2</sub> = ''N''(''N'' + 1)/2}} and {{math|1=''N'' = ''n''<sub>1</sub> + ''n''<sub>2</sub>}}, and doing some [[algebra]], we find that the sum is :::{{math|1=''U''<sub>1</sub> + ''U''<sub>2</sub> = ''n''<sub>1</sub>''n''<sub>2</sub>}}. ==Properties== The maximum value of ''U'' is the product of the sample sizes for the two samples (i.e.: <math>U_i = n_1 n_2</math>). In such a case, the "other" ''U'' would be 0. ==Examples== ===Illustration of calculation methods=== Suppose that [[Aesop]] is dissatisfied with his [[The Tortoise and the Hare|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 beats, getting 6, 1, 1, 1, 1, 1, which means that {{math|1=''U<sub>T</sub>'' = 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, so {{math|1=''U<sub>H</sub>'' = 25}}. Note that the sum of these two values for {{math|1=''U'' = 36}}, which is {{math|6×6}}. * Using the indirect method: : rank the animals by the time they take to complete the course, so give the first animal home rank 12, the second rank 11, and so forth. : the sum of the ranks achieved by the tortoises is {{math|1=12 + 6 + 5 + 4 + 3 + 2 = 32}}. :: Therefore {{math|1=''U<sub>T</sub>'' = 32 − (6×7)/2 = 32 − 21 = 11}} (same as method one). :: The sum of the ranks achieved by the hares is {{math|1=11 + 10 + 9 + 8 + 7 + 1 = 46}}, leading to {{math|1=''U<sub>H</sub>'' = 46 − 21 = 25}}. <!-- ===Illustration of object of test=== A second example race illustrates the point that the Mann–Whitney ''U'' test does not test for inequality of [[median]]s, but rather for difference of distributions. Consider another hare and tortoise race, with 19 participants of each species, in which the outcomes are as follows, from first to last past the finishing post: :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 If we simply compared medians, we would conclude that the median time for tortoises is less than the median time for hares, because the median tortoise here (in bold) comes in at position 19, and thus actually beats the median hare (in bold), which comes in at position 20. However, the value of ''U'' is 100 (using the quick method of calculation described above, we see that each of 10 tortoises beats each of 10 hares, so {{math|1=''U'' = 10×10}}). Consulting tables, or using the approximation below, we find that this ''U'' value gives significant evidence that hares tend to have lower completion times than tortoises ({{math|''p'' < 0.05}}, two-tailed). Obviously these are extreme distributions that would be spotted easily, but in larger samples something similar could happen without it being so apparent. Notice that the problem here is not that the two distributions of ranks have different [[variance]]s; they are mirror images of each other, so their variances are the same, but they have very different [[skewness]]. --> ===Example statement of results=== In reporting the results of a Mann–Whitney ''U'' test, it is important to state:<ref>{{Cite journal |last1=Fritz |first1=Catherine O. |last2=Morris |first2=Peter E. |last3=Richler |first3=Jennifer J. |date=2012 |title=Effect size estimates: Current use, calculations, and interpretation. |url=http://doi.apa.org/getdoi.cfm?doi=10.1037/a0024338 |journal=Journal of Experimental Psychology: General |language=en |volume=141 |issue=1 |pages=2–18 |doi=10.1037/a0024338 |pmid=21823805 |issn=1939-2222}}</ref> *A measure of the central tendencies of the two groups (means or medians; since the Mann–Whitney ''U'' test is an ordinal test, medians are usually recommended) *The value of ''U'' (perhaps with some measure of effect size, such as [[#Common language effect size|common language effect size]] or [[#Rank-biserial correlation|rank-biserial correlation]]). *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 {{math|1=''U'' = 10.5}}, {{math|1=''n''<sub>1</sub> = ''n''<sub>2</sub> = 8}}, {{math|1=''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.<ref>{{cite book |title= Nonparametric Statistical Methods |author1=Myles Hollander |author2=Douglas A. Wolfe |publisher= Wiley-Interscience |edition=2 |year=1999 |isbn= 978-0471190455}}</ref> 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, {{math|1=2''P'' = 0.02}}, {{math|1=''ρ'' = 0.58}})." However it would be rare to find such an extensive report in a document whose major topic was not statistical inference. ==Normal approximation and tie correction== For large samples, ''U'' is approximately [[normal distribution|normally distributed]]. In that case, the [[standard score|standardized value]] :<math>z = \frac{ U - m_U }{ \sigma_U }, \, </math> 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 :<math>m_U = \frac{n_1 n_2}{2}, \, </math> <ref name="auto">{{cite book |last1=Siegal |first1=Sidney (1956) |title=Nonparametric statistics for the behavioral sciences |publisher=McGraw-Hill |page=121}}</ref> and :<math>\sigma_U=\sqrt{n_1 n_2 (n_1 + n_2+1) \over 12}. \, </math> <ref name="auto"/> 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: :<math> \sigma_\text{ties}=\sqrt{ {n_1 n_2 (n_1 + n_2 +1) \over 12 } - { n_1 n_2 \sum_{k=1}^K (t_k^3 - t_k) \over 12 n(n-1) } },\, </math> <ref>{{cite book |last1=Lehmann |first1=Erich | last2=D'Abrera | first2=Howard (1975) |title=Nonparametrics: Statistical Methods Based on Ranks |publisher=Holden-Day |page=20}}</ref> 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 ''k''th rank, and ''K'' is the total number of unique ranks with ties. A more computationally-efficient form with {{math|1=''n''<sub>1</sub>''n''<sub>2</sub>/12}} factored out is :<math> \sigma_\text{ties}=\sqrt{ {n_1 n_2 \over 12 } \left( (n+1) - { \sum_{k=1}^K (t_k^3 - t_k) \over n(n-1)} \right)},</math> where {{math|1=''n'' = ''n''<sub>1</sub> + ''n''<sub>2</sub>}}. 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 {{math|1=''U''<sub>1</sub> + ''U''<sub>2</sub> = ''n''<sub>1</sub>''n''<sub>2</sub>}}, the mean {{math|1=''n''<sub>1</sub>''n''<sub>2</sub>/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. ==Effect sizes== It is a widely recommended practice for scientists to report an [[effect size]] for an inferential test.<ref name="Wilkinson1999">{{cite journal | last=Wilkinson | first=Leland | title=Statistical methods in psychology journals: Guidelines and explanations | year=1999 | journal=American Psychologist | volume=54 | pages=594–604 | doi=10.1037/0003-066X.54.8.594 | issue=8}}</ref><ref name="Nakagawa2007">{{cite journal | last=Nakagawa | first=Shinichi |author2=Cuthill, Innes C | year=2007 | title=Effect size, confidence interval and statistical significance: a practical guide for biologists | journal = Biological Reviews of the Cambridge Philosophical Society | volume=82 | pages=591–605 | doi=10.1111/j.1469-185X.2007.00027.x | pmid=17944619 | issue=4| s2cid=615371 }}</ref> ===Proportion of concordance out of all pairs=== The following measures are equivalent. ====Common language effect size==== One method of reporting the effect size for the Mann–Whitney ''U'' test is with ''f'', the common language effect size.<ref name="Kerby2014">{{cite journal | last1 = Kerby | first1 = D.S. | year = 2014 | title = The simple difference formula: An approach to teaching nonparametric correlation | journal = Comprehensive Psychology | volume = 3| page = 11.IT.3.1| doi = 10.2466/11.IT.3.1 | s2cid = 120622013 | doi-access = free }}</ref><ref name="McGraw1992">{{cite journal | last1 = McGraw | first1 = K.O. | last2 = Wong | first2 = J.J. | year = 1992 | title = A common language effect size statistic | journal = Psychological Bulletin | volume = 111 | issue = 2| pages = 361–365 | doi = 10.1037/0033-2909.111.2.361 }}</ref> 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).<ref name="McGraw1992"/> 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%.<ref>{{Cite journal | author = Grissom RJ | year = 1994| title = Statistical analysis of ordinal categorical status after therapies | journal = [[Journal of Consulting and Clinical Psychology]] | volume = 62| issue = 2| pages = 281–284| doi= 10.1037/0022-006X.62.2.281 | pmid = 8201065}}</ref> The relationship between ''f'' and the Mann–Whitney ''U'' (specifically <math>U_1</math>) is as follows: :<math> f = {U_1 \over n_1 n_2} \,</math> This is the same as the [[#Area-under-curve (AUC) statistic for ROC curves|area under the curve (AUC) for the ROC curve]]. ====''ρ'' statistic==== A statistic called ''ρ'' that is linearly related to ''U'' and widely used in studies of categorization ([[discrimination learning]] involving [[concept]]s), and elsewhere,<ref name="H1976" /> is calculated by dividing ''U'' by its maximum value for the given sample sizes, which is simply {{math|1=''n''<sub>1</sub>×''n''<sub>2</sub>}}. ''ρ'' is thus a non-parametric measure of the overlap between two distributions; it can take values between 0 and 1, and it estimates {{math|1=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 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.{{citation needed|date=February 2012}} ===Rank-biserial correlation=== 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.<ref>{{cite journal | last1 = Cureton | first1 = E.E. | year = 1956 | title = Rank-biserial correlation | journal = Psychometrika | volume = 21 | issue = 3| pages = 287–290 | doi = 10.1007/BF02289138 | s2cid = 122500836 }}</ref> 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:<ref name="Kerby2014"/> :<math>r = f - u </math> 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 {{math|1=''r'' = 0.80}}. An alternative formula for the rank-biserial can be used to calculate it from the Mann–Whitney ''U'' (either <math>U_1</math> or <math>U_2</math>) and the sample sizes of each group:<ref>{{cite journal | last1 = Wendt | first1 = H.W. | year = 1972 | title = Dealing with a common problem in social science: A simplified rank-biserial coefficient of correlation based on the ''U'' statistic | journal = European Journal of Social Psychology | volume = 2 | issue = 4| pages = 463–465 | doi = 10.1002/ejsp.2420020412 }}</ref> : <math> r = f - (1 - f) = 2 f - 1 = {2U_1 \over n_1 n_2} - 1 = 1 - {2U_2 \over n_1 n_2} </math> 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 {{math|1=''U<sub>2</sub>'' = 10}}. This formula then gives {{math|1=''r'' = 1 – (2×10) / (10×10) = 0.80}}, which is the same result as with the simple difference formula above. ==Relation to other tests== ===Comparison to Student's ''t''-test=== 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. ;Ordinal data: The Mann–Whitney ''U'' test is preferable to the ''t''-test when the data are [[Level of measurement#Ordinal scale|ordinal]] but not interval scaled, in which case the spacing between adjacent values of the scale cannot be assumed to be constant. ;Robustness:As it compares the sums of ranks,<ref name="Motulsky 2007">Motulsky, Harvey J.; ''Statistics Guide'', San Diego, CA: GraphPad Software, 2007, p. 123</ref> the Mann–Whitney ''U'' test is less likely than the ''t''-test to spuriously indicate significance because of the presence of [[outlier]]s. However, the Mann–Whitney ''U'' test may have worse [[Type I and type II errors|type I error]] control when data are both heteroscedastic and non-normal.<ref>{{Cite journal|last=Zimmerman|first=Donald W.|date=1998-01-01|title=Invalidation of Parametric and Nonparametric Statistical Tests by Concurrent Violation of Two Assumptions|journal=The Journal of Experimental Education|volume=67|issue=1|pages=55–68|doi=10.1080/00220979809598344|issn=0022-0973}}</ref> ;Efficiency:When normality holds, the Mann–Whitney ''U'' test has an (asymptotic) [[Efficiency (statistics)|efficiency]] of 3/{{pi}} or about 0.95 when compared to the ''t''-test.<ref name="Lehmann 1999">Lehamnn, Erich L.; ''Elements of Large Sample Theory'', Springer, 1999, p. 176</ref> For distributions sufficiently far from normal and for sufficiently large sample sizes, the Mann–Whitney ''U'' test is considerably more efficient than the ''t''.<ref name="Conover 1980">Conover, William J.; [https://onlinepubs.trb.org/onlinepubs/nchrp/cd-22/manual/v2chapter6.pdf ''Practical Nonparametric Statistics''], John Wiley & Sons, 1980 (2nd Edition), pp. 225–226</ref> This comparison in efficiency, however, should be interpreted with caution, as Mann–Whitney and the t-test do not test the same quantities. If, for example, a difference of group means is of primary interest, Mann–Whitney is not an appropriate test.<ref>{{Cite journal|last1=Lumley|first1=Thomas|last2=Diehr|first2=Paula|author2-link=Paula Diehr|last3=Emerson|first3=Scott|last4=Chen|first4=Lu|date=May 2002|title=The Importance of the Normality Assumption in Large Public Health Data Sets|journal=Annual Review of Public Health|volume=23|issue=1|pages=151–169|doi=10.1146/annurev.publhealth.23.100901.140546|pmid=11910059| doi-access=free|issn=0163-7525}}</ref> The Mann–Whitney ''U'' test will give very similar results to performing an ordinary parametric two-sample [[t test|''t''-test]] on the rankings of the data.<ref>{{cite journal |doi=10.2307/2683975 |title=Rank Transformations as a Bridge Between Parametric and Nonparametric Statistics |first1=William J. |last1=Conover |first2=Ronald L. |last2=Iman |author-link2=Ronald L. Iman |journal=[[The American Statistician]] |volume=35 |issue=3 |year=1981 |pages=124–129 |jstor=2683975 }}</ref> {| class="wikitable float-right" |+Relative efficiencies of the Mann–Whitney test versus the two-sample ''t''-test if ''f'' = ''g'' equals a number of distributions<ref>{{Cite book |last=Vaart |first=A. W. van der |url=http://dx.doi.org/10.1017/cbo9780511802256 |title=Asymptotic Statistics |date=1998-10-13 |publisher=Cambridge University Press |doi=10.1017/cbo9780511802256 |isbn=978-0-511-80225-6}}</ref> !Distribution !Efficiency |- |Logistic |<math>\pi^2/9</math> |- |Normal |<math>3/\pi </math> |- |Laplace |3/2 |- |Uniform |1 |} ===Different distributions=== The Mann–Whitney ''U'' test is not valid for testing the null hypothesis <math>P(Y>X)+0.5P(Y=X)= 0.5</math> against the alternative hypothesis <math>P(Y>X)+0.5P(Y=X)\neq 0.5</math>), without assuming that the distributions are the same under the null hypothesis (i.e., assuming <math>F_1=F_2</math>).<ref name="FayProschan2010" /> To test between those hypotheses, better tests are available. Among those are the [[Brunner_Munzel_Test|Brunner-Munzel]] and the Fligner–Policello test.<ref>{{Cite book| publisher = Springer International Publishing| last1 = Brunner| first1 = Edgar| last2 = Bathke| first2 = Arne C.| last3 = Konietschke| first3 = Frank| title = Rank and pseudo-rank procedures for independent observations in factorial designs: Using R and SAS| location = Cham| series = Springer Series in Statistics| date = 2018| doi = 10.1007/978-3-030-02914-2| url = http://link.springer.com/10.1007/978-3-030-02914-2| isbn = 978-3-030-02912-8 }}</ref> Specifically, under the more general null hypothesis <math>P(Y>X)+0.5P(Y=X)= 0.5</math>, 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.<ref name="karch">{{Cite journal| doi = 10.1177/2515245921999602| issn = 2515-2459| volume = 4| issue = 2| last = Karch| first = Julian D.| title = Psychologists Should Use Brunner–Munzel's Instead of Mann–Whitney's ''U'' Test as the Default Nonparametric Procedure| journal = Advances in Methods and Practices in Psychological Science| date = 2021| doi-access = free| hdl = 1887/3209569| hdl-access = free}}</ref> 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.<ref name="karch" /> ====Alternatives==== 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.<ref>{{cite journal |doi=10.1006/anbe.2001.1691 |title=Mann–Whitney ''U'' test when variances are unequal | volume=61 |issue=6 | year=2001 |journal=Animal Behaviour |pages=1247–1249 | last1 = Kasuya | first1 = Eiiti|s2cid=140209347 }}</ref> In that situation, the [[Welch's t-test|unequal variances]] version of the ''t''-test may give more reliable results. Similarly, some authors (e.g., Conover{{full citation needed|date=November 2012}}) 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|''F''-test]] for equal variances.{{citation needed|date=February 2012}} A more powerful test is the [[Brunner_Munzel_Test|Brunner-Munzel test]], outperforming the Mann–Whitney ''U'' test in case of violated assumption of exchangeability.<ref>{{cite journal |doi=10.1177/2515245921999602 |title=Psychologists Should Use Brunner–Munzel's Instead of Mann–Whitney's ''U'' Test as the Default Nonparametric Procedure | volume=4 |issue=2 | year=2021 |journal= Advances in Methods and Practices in Psychological Science| last1 = Karch | first1 = Julian | url = https://journals.sagepub.com/doi/full/10.1177/2515245921999602| hdl=1887/3209569 |s2cid=235521799 | hdl-access=free }}</ref> The Mann–Whitney ''U'' test is a special case of the [[proportional odds model]], allowing for covariate-adjustment.<ref>{{cite journal |title=Violation of Proportional Odds is Not Fatal | last1 = Harrell | first1 = Frank| date = 20 September 2020 | url = https://www.fharrell.com/post/po/}}</ref> See also [[Kolmogorov–Smirnov test]]. ==Related test statistics== ===Kendall's tau=== The Mann–Whitney ''U'' test is related to a number of other non-parametric statistical procedures. For example, it is equivalent to [[Kendall tau rank correlation coefficient|Kendall's tau]] correlation coefficient if one of the variables is binary (that is, it can only take two values).{{citation needed|date=February 2012}} ==Software implementations== 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:<ref>{{cite journal |title=Different Outcomes of the Wilcoxon–Mann–Whitney Test from Different Statistics Packages |first1=Reinhard |last1=Bergmann |first2=John |last2=Ludbrook |first3=Will P.J.M. |last3=Spooren |journal=The American Statistician |volume=54 |issue=1 |year=2000 |pages=72–77 |jstor=2685616 |doi=10.1080/00031305.2000.10474513|s2cid=120473946 }}</ref> * [[MATLAB]] has [http://www.mathworks.co.uk/help/stats/ranksum.html {{mono|ranksum}}] in its Statistics Toolbox. * [[R (programming language)|R]]'s statistics base-package implements the test [http://stat.ethz.ch/R-manual/R-patched/library/stats/html/wilcox.test.html {{mono|wilcox.test}}] in its "stats" package. * The R function [https://search.r-project.org/CRAN/refmans/rcompanion/html/wilcoxonZ.html {{mono|wilcoxonZ}}] from the [https://CRAN.R-project.org/package=rcompanion {{mono|rcompanion}}] package will calculate the {{Math|''z''}} statistic for a Wilcoxon two-sample, paired, or one-sample test. * [[SAS (software)|SAS]] implements the test in its <code>PROC NPAR1WAY</code> procedure. * [[Python (programming language)|Python]] has an implementation of this test provided by [[SciPy]].<ref>{{cite web |url=http://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.mannwhitneyu.html |title=scipy.stats.mannwhitneyu |work=SciPy v0.16.0 Reference Guide |author=<!--Staff writer(s); no by-line.--> |date=24 July 2015 |publisher=The Scipy community |access-date=11 September 2015 |quote=scipy.stats.mannwhitneyu(x, y, use_continuity=True): Computes the Mann–Whitney rank test on samples x and y.}}</ref> * [[SigmaStat]] (SPSS Inc., Chicago, IL) * [[SYSTAT (statistics)|SYSTAT]] (SPSS Inc., Chicago, IL) * [[Java (programming language)|Java]] has an implementation of this test provided by [[Apache Commons]]<ref>{{Cite web|url=http://commons.apache.org/proper/commons-math/javadocs/api-3.3/org/apache/commons/math3/stat/inference/MannWhitneyUTest.html|title=MannWhitneyUTest (Apache Commons Math 3.3 API)|website=commons.apache.org}}</ref> *[[Julia (programming language)|Julia]] has implementations of this test through several packages. In the package <code>HypothesisTests.jl</code>, this is found as <code>pvalue(MannWhitneyUTest(X, Y))</code>.<ref>{{Cite web|url=https://github.com/JuliaStats/HypothesisTests.jl|title=JuliaStats/HypothesisTests.jl|website=GitHub|date=30 May 2021}}</ref> * [[JMP (statistical software)|JMP]] (SAS Institute Inc., Cary, NC) * [[S-Plus]] (MathSoft, Inc., Seattle, WA) * [[STATISTICA]] (StatSoft, Inc., Tulsa, OK) * [[UNISTAT]] (Unistat Ltd, London) * [[SPSS]] (SPSS Inc, Chicago) * [[StatsDirect]] (StatsDirect Ltd, Manchester, UK) implements [http://www.statsdirect.com/help/Default.htm#nonparametric_methods/mann_whitney.htm all common variants]. * [[Stata]] (Stata Corporation, College Station, TX) implements the test in its [https://www.stata.com/help.cgi?ranksum {{mono|ranksum}}] command. * [[StatXact]] (Cytel Software Corporation, Cambridge, Massachusetts) * [[PSPP]] implements the test in its [https://www.gnu.org/software/pspp/manual/html_node/WILCOXON.html {{mono|WILCOXON}}] function. * [[KNIME]] implements the test in its [https://hub.knime.com/knime/extensions/org.knime.features.stats2/latest/org.knime.base.node.stats.testing.wilcoxonmannwhitney.WilcoxonMannWhitneyNodeFactory Wilcoxon–Mann–Whitney Test] node. ==History== The statistic appeared in a 1914 article<ref name="Kruskal57">{{cite journal |jstor=2280906 |title=Historical Notes on the Wilcoxon Unpaired Two-Sample Test |last=Kruskal |first=William H. |journal=Journal of the American Statistical Association |date=September 1957 |volume=52 |issue=279 |pages=356–360 |doi=10.2307/2280906}}</ref> by the German Gustav Deuchler (with a missing term in the variance). In a single paper in 1945, [[Frank Wilcoxon]] proposed <ref name="wilcoxon1945">{{cite journal |doi=10.2307/3001968 |last=Wilcoxon |first=Frank |author-link=Frank Wilcoxon |year=1945 |title=Individual comparisons by ranking methods |journal=[[Biometrics Bulletin]] |volume=1 |issue=6 |pages=80–83 |jstor=3001968 |hdl=10338.dmlcz/135688 |hdl-access=free }}</ref> 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<!-- source: Olson, cited with url link in Mann article --> Donald Ransom Whitney in 1947.<ref name="mannwhitney1947">{{cite journal |first1=Henry B. |last1=Mann |author-link=Henry Mann |first2=Donald R. |last2=Whitney |title=On a Test of Whether one of Two Random Variables is Stochastically Larger than the Other |journal=[[Annals of Mathematical Statistics]] |volume=18 |issue=1 |year=1947 |pages=50–60 |doi=10.1214/aoms/1177730491 |mr=22058 |zbl=0041.26103 |doi-access=free }}</ref> This article discussed alternative hypotheses, including a [[stochastic ordering]] (where the [[cumulative distribution function]]s satisfied the pointwise inequality {{math|1=''F''<sub>''X''</sub>(''t'') < ''F''<sub>''Y''</sub>(''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. ==See also== * [[Lepage test]] * [[Cucconi test]] * [[Kolmogorov–Smirnov test]] * [[Wilcoxon signed-rank test]] * [[Kruskal–Wallis one-way analysis of variance]] * [[Brunner Munzel Test|Brunner Munzel test]] * [[Proportional odds model]] ==Notes== {{Reflist|30em|refs= *<ref name="H1976">{{cite journal |doi=10.1037/0097-7403.2.4.285 |last1=Herrnstein |first1=Richard J. |last2=Loveland |first2=Donald H. |last3=Cable |first3=Cynthia |year=1976 |title=Natural Concepts in Pigeons |journal=Journal of Experimental Psychology: Animal Behavior Processes |volume=2 |issue=4 |pages=285–302 |pmid=978139 }}</ref> }} ==References== * {{cite book|last1=Hettmansperger|first1=T.P.|last2=McKean|first2=J.W.|title=Robust nonparametric statistical methods| edition=First ed., rather than Taylor and Francis (2010) second|series=Kendall's Library of Statistics|volume=5|publisher=Edward Arnold; John Wiley and Sons, Inc.|location=London; New York|year=1998|pages=xiv+467|isbn=978-0-340-54937-7|mr=1604954}} *{{cite book |last1=Corder |first1=G.W. |last2=Foreman |first2=D.I. |year=2014 |title=Nonparametric Statistics: A Step-by-Step Approach |publisher=Wiley |isbn=978-1118840313 }} * {{cite journal|last1=Hodges|first1=J.L.|last2=Lehmann| first2=E.L.|author-link2=Erich Leo Lehmann| year=1963| title=Estimation of location based on ranks|journal=[[Annals of Mathematical Statistics]]|volume=34|pages=598–611|mr=152070|doi=10.1214/aoms/1177704172|zbl=0203.21105|jstor=2238406|id={{Project Euclid|euclid.aoms/1177704172}}|issue=2|doi-access=free}} *{{cite journal | last1 = Kerby | first1 = D.S. | year = 2014 | title = The simple difference formula: An approach to teaching nonparametric correlation | journal = Comprehensive Psychology | volume = 3| page = 11.IT.3.1| doi = 10.2466/11.IT.3.1 | s2cid = 120622013 | doi-access = free }} * {{cite book| last=Lehmann|first=Erich L.|author-link=Erich Leo Lehmann|title=Nonparametrics: Statistical methods based on ranks|edition=Reprinting of 1988 revision of 1975 Holden-Day | publisher=Springer | location=New York|year=2006|pages=xvi+463|isbn=978-0-387-35212-1|mr=395032|others=With the special assistance of H.J.M. D'Abrera}} *{{cite book|last=Oja|first=Hannu |title=Multivariate nonparametric methods with ''R'': An approach based on spatial signs and ranks|series=Lecture Notes in Statistics|volume=199|publisher=Springer|location=New York|year=2010|pages=xiv+232|isbn=978-1-4419-0467-6|doi=10.1007/978-1-4419-0468-3|mr=2598854}} * {{cite journal|doi=10.2307/2527532|last=Sen|first=Pranab Kumar|author-link=Pranab K. Sen|date=December 1963|title=On the estimation of relative potency in dilution(-direct) assays by distribution-free methods|journal=Biometrics|volume=19|pages=532–552|issue=4|jstor=2527532|zbl=0119.15604<!-- save for links to future articles -->}} ==External links== * Table of critical values of ''U'' [http://math.usask.ca/~laverty/S245/Tables/wmw.pdf (pdf)] * [https://web.archive.org/web/20140924175626/http://faculty.vassar.edu/lowry/utest.html Interactive calculator] for ''U'' and its significance * [http://core.ecu.edu/psyc/wuenschk/docs30/Nonparametric-EffectSize.pdf Brief guide by experimental psychologist Karl L. Weunsch] – Nonparametric effect size estimators (Copyright 2015 by Karl L. Weunsch) {{statistics|inference}} {{DEFAULTSORT:Mann-Whitney U}} [[Category:Statistical tests]] [[Category:Nonparametric statistics]] [[Category:U-statistics]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Citation needed
(
edit
)
Template:Cite book
(
edit
)
Template:Cite journal
(
edit
)
Template:Cite web
(
edit
)
Template:Full citation needed
(
edit
)
Template:Italic title
(
edit
)
Template:Math
(
edit
)
Template:Mono
(
edit
)
Template:Pi
(
edit
)
Template:Redirect
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)
Template:Statistics
(
edit
)