= Solution
Assume the null distribution is a <centrally symmetric probability distribution>, so $X_i$ and $-X_i$ have the same law. A <sign-flip randomization test> draws signs $s_i\in\{-1,1\}$ independently and recomputes, for example,
$$
T(s)=n\left\lVert\frac1n\sum_{i=1}^ns_iX_i\right\rVert^2.
$$
The exact p-value averages over all $2^n$ sign vectors:
$$
p=2^{-n}\#\{s:T(s)\geq T(1,\ldots,1)\}.
$$
With $B$ random sign vectors, including the observed configuration, the standard Monte Carlo version is $(1+\#\{b:T_b\geq T_0\})/(B+1)$, where $T_0$ is the observed statistic. Joint sign invariance under the null makes this finite-sample valid.
Back to article page