Compare two independent groups without assuming normal data. Get U, an exact p-value for small samples (normal approximation for large or tied ones), and the chance a value from one group beats the other.
U₁ = R₁ − n₁(n₁ + 1) ÷ 2
The groups can be different sizes. With no ties and up to 30 per group, the p-value is exact.
The Mann–Whitney U test compares two independent groups using only the order of the values, not their sizes. It asks whether values from one group tend to be larger than values from the other.
U counts how many times a value from one group beats a value from the other across every possible pairing. If the groups are alike, each wins about half the pairings; a U near zero or near n₁ × n₂ means one group almost always wins.
Because it uses ranks, outliers and skewed data don't throw it off. That makes it the usual alternative to the two-sample t-test for small samples, ratings or data that clearly aren't normal.
As defined by Mann and Whitney (1947); tie correction as in Hollander, Wolfe and Chicken. See Sources.
In 29 of the 30 possible caffeine-versus-no-caffeine pairings, the caffeine score was lower. Only the 20 beats the 19.
The exact two-sided p-value when one group is completely above the other (U = 0). With very small groups, even perfect separation can't reach 5%.
| Group sizes | Best possible p | Can reach 5%? |
|---|---|---|
| 2 and 2 | 0.3333 | No |
| 3 and 3 | 0.1 | No |
| 3 and 4 | 0.0571 | No |
| 4 and 4 | 0.0286 | Yes |
| 5 and 5 | 0.0079 | Yes |
Yes, they’re equivalent. Wilcoxon uses the rank sum W, Mann and Whitney the count U, and W = U₁ + n₁(n₁ + 1)/2. The p-values are identical.
With small samples that look clearly non-normal, with outliers, or with ordinal data such as ratings.
It’s U₁ ÷ (n₁n₂), the probability of superiority: the share of all cross-group pairings won by group 1. 50% means no tendency either way; the caffeine example gives 3.3%.
Tied values share their average rank, and the normal approximation uses a variance correction for ties. The exact p-value is used only without ties.
No. Any sizes work, though small groups give little power.
Independent observations, and values that can at least be ordered. It doesn’t assume normality.
wilcox.test(group1, group2). R reports W, which equals U₁ here.
Use the Kruskal–Wallis test, the rank-based counterpart of one-way ANOVA.
Related Tools