Given vectors \(X\) and \(Y\), computes \(B_X\) and \(B_Y\) as
described by Baumgartner et al., returning their average, \(B\).
The test statistic approximates the variance-weighted square norm of the
difference in CDFs of the two distributions. For sufficiently large sample
sizes (more than 20, say), under the null the test statistic approaches the asymptotic
value computed in bws_cdf
.
The test value is an approximation of
$$\tilde{B} = \frac{mn}{m+n} \int_0^1 \frac{1}{z(1-z)} \left(F_X(z) - F_Y(z)\right)^2 \mathrm{dz},$$
where \(m\) (\(n\)) is the number of elements in \(X\) (\(Y\)), and
\(F_X(z)\) (\(F_Y(z)\)) is the CDF of \(X\) (\(Y\)).
The test statistic is based only on the ranks of the input. If the same
monotonic transform is applied to both vectors, the result should be unchanged.
Moreover, the test is inherently two-sided, so swapping \(X\) and \(Y\)
should also leave the test statistic unchanged.