What the Mann–Whitney U test does
The Mann–Whitney U test, also called the Wilcoxon rank-sum test, compares two independent groups without assuming that the data are normally distributed. Instead of the raw values, it uses their ranks: all observations are pooled, sorted and numbered from 1 to N. If one group tends to have larger values, its ranks pile up at the top. It is the usual alternative to the two-sample t-test for skewed data, ordinal scores (such as satisfaction ratings or pain scales) and small samples with outliers.
The formulas
- U₁ = R₁ − n₁(n₁ + 1) ÷ 2, where R₁ is the sum of the ranks of group 1.
- U₁ counts the pairs (one value from each group) in which group 1 is larger; U₂ = n₁n₂ − U₁.
- Under the null hypothesis, U has mean n₁n₂ ÷ 2 and standard deviation √(n₁n₂(n₁ + n₂ + 1) ÷ 12).
- z = (U₁ − mean ± 0.5) ÷ SD, where the 0.5 is the continuity correction, and the p-value comes from the normal distribution.
Example
Group 1 has 8 values and group 2 has 10, and U₁ = 15:
- expected U: 8 × 10 ÷ 2 = 40, with an SD of √(80 × 19 ÷ 12) ≈ 11.25;
- z = (25 − 0.5) ÷ 11.25 ≈ 2.18;
- two-tailed p ≈ 0.029: significant at α = 0.05;
- a value from group 1 beats a value from group 2 in only 18.8% of pairs, so group 1 tends to be lower; the rank-biserial correlation is −0.63, a large effect.
Reading the effect size
The rank-biserial correlation runs from −1 to 1: 0 means complete overlap, ±1 means every value of one group exceeds every value of the other. The “probability of superiority” U₁ ÷ (n₁n₂) is often easier to explain: it is the chance that a random member of group 1 scores higher than a random member of group 2.
Assumptions and limits
- The two groups are independent; for paired data, use the Wilcoxon signed-rank test.
- Observations are at least ordinal.
- Strictly, the test compares whole distributions. It reads as a comparison of medians only when the two distributions have a similar shape.
- With many ties, the SD should be corrected for ties; the uncorrected value used here is slightly conservative.
- For fewer than about 20 observations in total, exact tables or software give a more accurate p-value than the normal approximation.