Learn more from fewer runsLesson 46 of 76 · 8 min
Pair opposite draws
Use antithetic variates and check whether their covariance is helpful.
Antithetic sampling pairs related draws with the same marginal distribution, often U and 1-U for a uniform input. Average the two function values to form one paired observation. If their covariance is negative, pairing can reduce variance.
For a monotone increasing function, high U produces a high value while 1-U produces a low one. The pair can balance. For other functions, both values can move together and the method may provide little benefit or even hurt.
Assess efficiency with the same number of function evaluations. The paired observations, not their individual members, are the independent units for the standard-error calculation. The example compares repeated estimates rather than applying an iid formula to correlated pair members.
- Uniform draw
- Paired opposite
- Average the pair
If f(U) equals f(1-U), does the pair provide the usual negative-covariance benefit?
Write a prediction (optional)
Seeded teaching simulation
Select Run Python below with the code unchanged.
A saved draft is open. To run the published example, open Tools and select Restore example. Recover draft brings your code back.
Execution error
Technical error details
Your result
Published example output
This result comes from the original Python. Your runs appear above. Build environment ↗
Exact expectation of exp(U): 1.718282 Ordinary SD across estimates: 0.037098 Antithetic SD across estimates: 0.006519 Equal function evaluations: 200
Read the first result
For this monotone integrand the pairing is useful. The result is conditional on the function, not a universal guarantee for opposite inputs.
Try an edit
Replace np.exp(u) + np.exp(1-u) with (u-.5)**2 + ((1-u)-.5)**2 and ordinary = np.exp(rng.random((repetitions, 2*pairs))).mean(axis=1) with ordinary = ((rng.random((repetitions, 2*pairs))-.5)**2).mean(axis=1) and print("Exact expectation of exp(U):", round(np.e-1, 6)) with print("Exact expectation of (U-.5)**2:", round(1/12, 6)). Select Run Python again. Compare Ordinary SD across estimates and Antithetic SD across estimates. What does pairing do when opposite draws now give the same outcome?
Scope. Antithetic pairing can fail to reduce variance for non-monotone functions and does not repair biased input models.
Try a fresh case
What is the independent resampling unit in an antithetic estimator built from independent pairs?
Need a hint?
Hint 1
Find what is independently generated.
Hint 2
Keep the two coupled evaluations together.