Mann–Whitney U test (source code)

= Mann–Whitney U test
{c}
{title2=$U_X=W_X-m(m+1)/2$}
{wiki}

= Wilcoxon rank sum test
{c}
{synonym}

For two independent samples of sizes $m,n$, rank their pooled observations and let $W_X$ be the sum of the ranks of the first sample. With continuous observations, the <null hypothesis> of a common distribution makes every allocation of $m$ ranks to that sample equally probable. A one-sided alternative that the first sample is stochastically smaller rejects for small $W_X$, equivalently small $U_X$. In a common-shape location model this tests a negative location difference. Without the common-shape assumption it is not simply a test of <medians>. The shifted statistic $U_X$ counts cross-sample pairs for which the first observation exceeds the second. Ties use average ranks and a conditional <permutation test> or a tie-adjusted <normal approximation>.