The Mann-Whitney U test (Wilcoxon rank-sum test) asks whether two samples come from the same distribution without assuming a normal shape — it works on ranks alone, so it survives skew and outliers that break the t-test.
Pool both samples (n1 + n2 values), rank them jointly
(tied values share the average of their ranks).
R_A = sum of ranks landing in Group A
U_A = R_A - n1(n1+1)/2
U_B = n1·n2 - U_A
U = min(U_A, U_B) range: 0 .. n1·n2
rank-biserial r = 1 - 2U / (n1·n2) (effect size, -1..1)
Small U means the two groups barely interleave when sorted — one group's values are consistently higher. The rank track on the left of the scene places every point at its rank position (evenly spaced) while its height still shows the real value, so you can see the interleaving pattern the statistic is built from.
The p-value here is not read off a table — it is earned by permutation: the joint ranks are fixed, then group labels are reshuffled 2,000 times to build the true null distribution of U under "no difference between groups", shown as the gray histogram. The p-value is the fraction of shuffles at least as extreme as the real split (highlighted bins).
- Sample size — more points per group sharpens the null distribution and makes small shifts easier to detect.
- Location shift — moves Group B's whole distribution; watch U shrink and the effect size grow as the shift increases.
- Distribution shape — Mann-Whitney's validity does not depend on this; try "skewed" to see a case where a t-test's normality assumption would be questionable but the rank test remains exact.