Understand the idea
It is commonly said that 'the Mann-Whitney test compares medians', and this is a convenient shorthand that is not always literally true. What the test actually asks is broader: if you picked one value at random from each group, how often would one group's value come out bigger than the other's?
When the two groups' distributions have the same basic shape and spread and differ only by being shifted up or down from each other, that broader question DOES reduce to a comparison of medians, and the shorthand is accurate. But if the two groups' distributions have different shapes or spreads (one much more variable than the other, or differently skewed), the test can be significant even when the two medians are nearly identical, or non-significant even when the medians visibly differ.
The safe habit: describe what Mann-Whitney actually tests (whether one group's values tend to rank higher overall) rather than automatically translating a significant result into 'the medians differ', unless you have also checked that the two distributions have a similar shape.
The Mann-Whitney U test, also called the rank-sum test, asks whether values from one group tend to be larger than values from the other; when one group's values are larger across the whole distribution, that is called stochastic dominance. The rank-sum test becomes a test of medians only under the location shift assumption: both groups have the same shape and spread, and one is simply slid along from the other.
Practitioner explanation
Mann-Whitney formally tests H0: P(X > Y) = 0.5 (stochastic equality) against a stochastic-dominance alternative; this is EQUIVALENT to a location-shift (median) comparison only under the additional assumption that the two population distributions have identical shape and dispersion and differ only by a location shift. Under unequal variances or different shapes, a significant Mann-Whitney result can occur with near-identical medians (driven instead by a spread or shape difference), and conversely.
The exact statement of what was tested should therefore name stochastic dominance or 'rank-based location shift under the shape-equality assumption', not unconditionally 'a difference in medians', unless the equal-shape assumption has actually been checked (visually, via overlaid histograms or a QQ-plot comparing the two groups' shapes) or is a priori very plausible.
KernelStats' Mann-Whitney card reports both group medians AND the rank-biserial correlation (the actual quantity the test is calibrated to detect), and the card's guidance text states the stochastic-dominance interpretation explicitly rather than defaulting to an unqualified 'the medians differ' framing.
Worked example
Scenario
Two groups have nearly identical medians, but group A is tightly clustered while group B is much more spread out with a long right tail.
Result
Mann-Whitney returns a significant p-value despite the two medians being almost equal.
Interpretation
The significant result reflects the difference in distributional SHAPE (spread/skew), not a difference in medians. Reporting this as 'the medians differ significantly' would misstate what the test actually detected; checking the two groups' histograms alongside the test result would have revealed this.
Common misconceptions
Misconception
A significant Mann-Whitney test always means the two groups' medians are different.
Correction
The test directly detects stochastic dominance (a tendency for one group's values to rank higher). This coincides exactly with a median difference only when both groups' distributions share the same shape and spread; otherwise, a significant result can reflect a difference in shape or spread rather than in the medians.
References
- NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.5.16 Wilcoxon rank-sum (Mann-Whitney) test, NIST/SEMATECH (2012), §1.3.5.16.
