Mann-Whitney U test
Shown in the app as mann_whitney. Part of the method reference, under Comparing groups.
When to use
Two independent groups, continuous/ordinal outcome, non-normal.
What you provide
- Outcome: one numeric column.
- Group: one categorical column with exactly two groups.
Options
Missing data
- Complete case (listwise deletion)
- Mean imputation (single)
- Median imputation (single)
Multiple comparisons
- Not adjustable for this method. Where it makes post-hoc comparisons, the procedure applies its own correction.
Confidence level
Every interval in the result is reported at the level you choose:
- 90%
- 95%
- 99%
Alternative hypothesis
Two-sided unless you choose otherwise. Choose a one-sided test only when the direction was specified before the data were seen; the result then says so.
- Two-sided: the first differs from the second in either direction
- One-sided: the first is lower than the second
- One-sided: the first is higher than the second
Related methods
Alternatives that take the same inputs:
Other methods under Comparing groups:
- Paired t-test
- Wilcoxon signed-rank test
- One-way ANOVA
- Welch's ANOVA
- Kruskal-Wallis test
- Repeated-measures ANOVA (Greenhouse-Geisser)
- ANCOVA (analysis of covariance)
- Two-way ANOVA (factorial)
Guides that discuss this method
- How to analyse values below the detection limit
- How to choose a statistical test for your data
- T-test or Mann-Whitney U test: which to use?
How to read the output
These methods compare one outcome between two independent groups, for example reading scores under two teaching methods, or plant height under two fertilisers.
Welch’s and Student’s t-tests. The estimate is the difference in group means, with the direction stated (first group minus second). Read it with its 95% confidence interval: the interval is the range of differences compatible with your data, and an interval that excludes 0 corresponds to p below 0.05. The p-value is the probability of a difference at least this large if the two population means were equal; it does not measure how large or important the difference is. The effect size is Cohen’s d, the mean difference in standard-deviation units. Cohen’s benchmarks of 0.2, 0.5 and 0.8 for small, medium and large are a rough guide, not a rule (Cohen, 1988).
Welch’s test does not assume equal variances, which is why it is the default. When the variances really are equal it loses very little compared with Student’s test (Delacre, Lakens and Leys, 2017).
Mann-Whitney U test. This rank test asks whether values in one group tend to be larger than values in the other. It is a test of medians only when the two distributions have the same shape. The estimate is the Hodges-Lehmann shift, the median of all differences between a value from one group and a value from the other, with its confidence interval. The effect size is the rank-biserial correlation, from -1 to 1, where 0 means neither group tends to be larger (Kerby, 2014).
Sources: Cohen J (1988), Statistical Power Analysis for the Behavioral Sciences, 2nd ed., Lawrence Erlbaum. Delacre M, Lakens D, Leys C (2017), International Review of Social Psychology 30(1):92-101, doi:10.5334/irsp.82. Kerby DS (2014), Comprehensive Psychology 3, doi:10.2466/11.IT.3.1.
Worked examples
Celeus's result on a published or illustrative dataset, next to an independent computation and, where one exists, a published value. The data themselves are not reproduced here.
datasets::airquality
- Source: Published dataset distributed with an R package
- Licence: base R (GPL)
- Reference: Chambers et al. (1983), Graphical Methods for Data Analysis
| Quantity | Celeus | Independent computation | Published value | Agrees |
|---|---|---|---|---|
| p-value | 6.10874e-05 | 6.10874e-05 | - | Yes |
chorioamnion permeability, 10 vs 5 (stats::wilcox.test help example)
- Source: Published dataset distributed with an R package
- Licence: base R (GPL)
- Reference: Hollander & Wolfe (1973), Nonparametric Statistical Methods, p. 69
| Quantity | Celeus | Independent computation | Published value | Agrees |
|---|---|---|---|---|
| Test statistic | 35 | 35 | - | Yes |
| p-value | 0.127206 | 0.127206 | - | Yes |
| Estimate | 0.305 | 0.305 | - | Yes |
| Lower confidence limit | -0.08 | -0.08 | - | Yes |
datasets::mtcars (am coded 0/1)
- Source: Published dataset distributed with an R package
- Licence: base R (GPL)
- Reference: Henderson & Velleman (1981), Biometrics 37(2)
| Quantity | Celeus | Independent computation | Published value | Agrees |
|---|---|---|---|---|
| Test statistic | 42 | 42 | - | Yes |
| p-value | 0.00115901 | 0.00115901 | - | Yes |
| Estimate | -6.8 | -6.8 | - | Yes |
| Confidence interval | -12.6, -1.7 | -12.6, -1.7 | - | Yes |
datasets::chickwts (horsebean vs linseed)
- Source: Published dataset distributed with an R package
- Licence: base R (GPL)
- Reference: Anonymous (1948), Biometrika 35
| Quantity | Celeus | Independent computation | Published value | Agrees |
|---|---|---|---|---|
| Test statistic | 20 | 20 | - | Yes |
| p-value | 0.00714456 | 0.00714456 | - | Yes |
| Estimate | -60.5 | -60.5 | - | Yes |
| Confidence interval | -105, -12 | -105, -12 | - | Yes |
datasets::chickwts (horsebean vs linseed)
- Source: Published dataset distributed with an R package
- Licence: base R (GPL)
- Reference: Anonymous (1948), Biometrika 35
| Quantity | Celeus | Independent computation | Published value | Agrees |
|---|---|---|---|---|
| Test statistic | 20 | 20 | - | Yes |
| p-value | 0.00714456 | 0.00714456 | - | Yes |
| Estimate | -60.5 | -60.5 | - | Yes |
| Confidence interval | -120, -1 | -120, -1 | - | Yes |
| Achieved confidence level of the interval | 0.991043 | 0.991043 | - | Yes |
References
- Mann, H. B., Whitney, D. R. (1947). On a test of whether one of two random variables is stochastically larger than the other. The Annals of Mathematical Statistics 18: 50-60. doi:10.1214/aoms/1177730491 doi:10.1214/aoms/1177730491
- Hodges, J. L., Lehmann, E. L. (1963). Estimates of location based on rank tests. The Annals of Mathematical Statistics 34: 598-611. doi:10.1214/aoms/1177704172 doi:10.1214/aoms/1177704172