Common random numbers (source code)

= Common random numbers

\b[Common random numbers] couples simulations of different systems by reusing the same random inputs when estimating a difference. The individual output <probability distributions> must stay correct; the useful change is their dependence. If paired outputs are $X,Y$ with finite <variances>, then
$$
\operatorname{Var}(X-Y)=\operatorname{Var}(X)+\operatorname{Var}(Y)-2\operatorname{Cov}(X,Y).
$$
Positive <covariance> therefore reduces the <variance> of their difference compared with independent outputs having those same marginal laws. This identity explains the technique, but does not guarantee a beneficial covariance for every simulation.<Some Guidelines and Guarantees for Common Random Numbers by Paul Glasserman and David D. Yao>[p.884, Introduction: variance identity and dependence mechanism]{ref}

For an original example, let $U$ have the <uniform distribution> on $[0,1]$, and compare $X=U$ with $Y=2U$. Their difference has <expected value> $-1/2$ and <variance> $1/12$. With independent uniforms $U,V$, the same marginal outputs $X=U$ and $Y=2V$ instead give
$$
\operatorname{Var}(U-2V)=\frac1{12}+\frac4{12}=\frac5{12}.
$$
Averaging $n$ independent pairs divides either variance by $n$. In this stipulated example, sharing the input reduces variance fivefold for the same number of pairs.

The sign matters. If outputs are $U$ and $1-U$, sharing $U$ gives difference $2U-1$ with variance $1/3$. Using independent inputs gives variance $1/6$, so this coupling is worse. Reusing an input is useful when it produces an appropriate response in both systems, not simply because the same seed appears in two runs. In a simulation with branching or different event counts, matching random inputs to corresponding events is part of specifying the coupling.<Some Guidelines and Guarantees for Common Random Numbers by Paul Glasserman and David D. Yao>[pp.884–885, common random numbers and synchronization; abstract, monotonicity conditions]{ref}