Normal approximation for a rank sum (source code)

= Normal approximation for a rank sum
{title2=$\mathbb EW_X=m(N+1)/2,\quad\operatorname{var}W_X=mn(N+1)/12$}

With $N=m+n$ and no ties, sampling $m$ <ranks of observations>[ranks] without replacement gives the displayed <mean> and <variance>. For observed <ranks of observations>[rank] sum below its <mean>, a continuity-corrected lower-tail statistic is $Z=[W_X-m(N+1)/2+1/2]/\sqrt{mn(N+1)/12}$. Ties of sizes $t_g$ replace the <variance> by $mn[(N+1)-\sum_g(t_g^3-t_g)/(N(N-1))]/12$. These formulas concern the raw <ranks of observations>[rank] sum; the <Mann–Whitney U test> statistic subtracts $m(m+1)/2$ from both the observation and its <mean>.