Permutation Tests and Wilcoxon Rank-Sum Test
Permutation and Wilcoxon rank-sum tests
A permutation test compares an observed statistic with values from relabeling observations under a justified exchangeability rule. The Wilcoxon rank-sum test applies this logic to pooled ranks for two independent groups, rather than directly comparing sample means.
Build the permutation reference
Choose a statistic and a null hypothesis that makes particular assignments equally likely. With n observations and nA A labels, there are (nAn) fixed-size assignments.
For a two-sided mean-difference test against zero, the exact p-value is the fraction whose absolute difference is at least the observed absolute difference, including the observed assignment. Another statistic may require a different definition of two-sided extremeness relative to its null distribution.
In a randomized experiment, relabeling can follow the assignment design under a sharp no-effect null. For independent observational samples, label exchangeability under an equal-distribution null needs separate justification. A permutation test using means is not automatically a test only of medians.
Use pooled ranks
For the Wilcoxon rank sum, pool the groups, sort all observations, and assign average ranks to ties. Add A's ranks to obtain W. The related Mann–Whitney statistic is U=W−nA(nA+1)/2: it counts A–B pairwise wins, with half credit for ties. An exchangeable equal-distribution null permits a rank-based reference by relabeling the ranks.
For a two-sided rank comparison, one centered extremeness measure is ∣W−nA(n+1)/2∣, equivalently ∣U−nAnB/2∣. Specify the one-sided or two-sided alternative before counting its tail. A high W suggests A tends to have larger observations; a location or median interpretation requires additional shape assumptions.
Worked example
Suppose A is {4,10} and B is {1,3,8}, with independent observations and no ties. The pooled order is 1, 3, 4, 8, 10, so A receives ranks 3 and 5.
Thus W=3+5=8, and U=8−2(3)/2=5, matching five A–B wins among six pairs. The exchangeable-null center is nAnB/2=3; the observed U is above that center, but this alone is not a significance verdict.
Group A has values 3, 7, 8; group B has 1, 4, 5. There are no ties. What are A’s Wilcoxon rank sum W and Mann–Whitney U?
An investigator measures each person before and after an intervention, then proposes to pool all before and after measurements and randomly reassign them as if they came from independent groups. Which critique is most accurate?