The wilcoxon mann test is the Wilcoxon rank-sum / Mann–Whitney U test, a nonparametric method for comparing two independent samples by analyzing the ranks of pooled observations rather than assuming normality.
Appropriate setting and hypotheses
- Two independent samples with sizes \(n_1\) and \(n_2\).
- Measurements are at least ordinal (ranking is meaningful).
- Null hypothesis: \(H_0\): the two population distributions are identical.
- Alternative hypothesis (two-sided): \(H_A\): the distributions differ (often interpreted as a location shift if shapes are similar).
Step-by-step procedure (rank-sum and U statistic)
1) Pool and rank the data
Combine both samples into one list of size \(N=n_1+n_2\). Assign ranks 1 to \(N\) from smallest to largest. If ties occur, each tied value receives the average of the ranks it would have occupied.
2) Compute the rank sum for one group
Let \(R_1\) be the sum of ranks for Group 1 (also denoted \(W\), the Wilcoxon rank-sum statistic).
3) Convert rank sum to the Mann–Whitney U statistic
The two U statistics are:
For a two-sided test, many references use \(U_{\min}=\min(U_1,U_2)\) as the test statistic (equivalently, either \(U_1\) with an appropriate tail convention).
Worked example (no ties)
| Group A (n1=5) | Group B (n2=5) |
|---|---|
| 12, 15, 17, 18, 20 | 8, 9, 10, 11, 13 |
Pool and rank the 10 observations:
| Value | Group | Rank |
|---|---|---|
| 8 | B | 1 |
| 9 | B | 2 |
| 10 | B | 3 |
| 11 | B | 4 |
| 12 | A | 5 |
| 13 | B | 6 |
| 15 | A | 7 |
| 17 | A | 8 |
| 18 | A | 9 |
| 20 | A | 10 |
Normal approximation (p-value) and decision
When sample sizes are not tiny, a common approach is to standardize \(U\) under \(H_0\). With no ties:
Using \(n_1=5\), \(n_2=5\), \(N=10\):
With a continuity correction for the lower tail (since \(U_{\min} < \mu_U\)):
Two-sided p-value:
Conclusion at \(\alpha=0.05\)
Since \(p \approx 0.0216 \le 0.05\), reject \(H_0\). The samples provide evidence that the two populations differ; the rank pattern indicates Group A tends to have larger values than Group B.
Ties (variance correction)
If ties occur, average ranks are still used, but \(\sigma_U^2\) should be adjusted. If tied groups have sizes \(t_1,t_2,\dots\), a common correction is:
Effect size (recommended alongside \(p\))
Two standard summaries are the common-language effect size \(\hat{A}\) and the rank-biserial correlation \(r_{rb}\):
Visualization: pooled ranks with group markers
Common checks before reporting
- Independence: if observations are paired/dependent, a signed-rank approach is required instead.
- Direction: for one-sided alternatives, use the \(U\) tail consistent with “Group 1 tends larger” or “Group 1 tends smaller.”
- State what was used: exact p-value (small samples) versus normal approximation (larger samples), and whether a tie correction/continuity correction was applied.