1. Definition

  • The Mann–Whitney U test (also called the Wilcoxon rank-sum test) is a non-parametric test used to compare two independent groups.
  • It answers: “Do these two groups come from the same distribution?”
  • Unlike the t-test, it does not assume normality. Instead, it compares the ranks of the data.

2. Assumptions

  • The two samples are independent.
  • The dependent variable should be ordinal or continuous.
  • If distributions are similar in shape, the test is often interpreted as comparing medians.

3. Test Statistic (U)

  1. Combine data from both groups and assign ranks.
  2. Compute the sum of ranks for each group ($R_1, R_2$​).
  3. Calculate:

$U_1 = n_1 n_2 + \frac{n_1(n_1+1)}{2} – R_1$​

$U_2 = n_1 n_2 + \frac{n_2(n_2+1)}{2} – R_2$

$U = \min(U_1, U_2)$

  • Large samples → $U$ is approximated by a normal distribution (z-test).

4. Hypotheses

  • Null hypothesis (H₀): The two groups come from the same distribution.
  • Alternative hypothesis (H₁): One group tends to have larger (or smaller) values than the other.

5. Example

Suppose we test exam scores:

  • Group A: 88, 92, 100, 75, 85
  • Group B: 60, 70, 65, 80, 72

We rank all values, compute rank sums, calculate $U$, and check the p-value.

  • If p < 0.05 → reject H₀ → groups differ significantly.

6. Connection to ROC-AUC

  • The Mann–Whitney U statistic is mathematically equivalent to ROC-AUC.
  • Interpretation: the probability that a randomly chosen observation from Group A has a higher score than a randomly chosen one from Group B.

Summary:
The Mann–Whitney U test is a non-parametric alternative to the t-test.
It checks whether two independent groups differ in distribution by comparing ranks.
It’s especially useful when the data are not normally distributed or when you only care about relative ordering.