Skip to content
Tutorials Center
My learning

Topics

Lesson 20 of 38 · Variance Reduction

Control Variates

Reduce Monte Carlo variance by subtracting a correlated quantity with a known mean. Derive the best coefficient and test it in Python.

Sometimes you cannot compute the answer you want, but you can compute the answer to a similar problem exactly. A control variate turns that knowledge into variance reduction. You simulate both quantities together, see how far the easy one drifts from its known value, and use that drift to correct the hard one.

Think of a bathroom scale that reads 1 kg too high today. If you weigh a known 5 kg bag on it and see 6 kg, you subtract 1 kg from every other reading. The control variate is that known bag.

The estimator

You want μ = E[X], where X = f(U). You also have a quantity C = g(U) computed from the same random draw, and you know E[C] = c exactly. For any constant β, define:

Text
X_β = X − β · (C − c)

Since E[C − c] = 0, X_β is unbiased for μ whatever β is. Its variance is:

Text
Var(X_β) = Var(X) − 2β·Cov(X, C) + β²·Var(C)

Minimizing over β (take the derivative and set it to zero) gives:

Text
β* = Cov(X, C) / Var(C)
Var(X_β*) = Var(X) · (1 − ρ²)

where ρ is the correlation between X and C. So a control with |ρ| = 0.9 removes 81% of the variance, and |ρ| = 0.99 removes 98%. The sign of the correlation does not matter; only its size.

flowchart LR
  A["Draw U"] --> B["X = f(U), hard mean"]
  A --> C["C = g(U), known mean c"]
  B --> D["X - beta * (C - c)"]
  C --> D
  D --> E["Lower-variance estimate of E[X]"]

One random draw feeds both quantities; the known mean of C corrects X.

Example: estimating e − 1

Again take X = e^U with true mean e − 1. A natural control is C = U with known mean 0.5: it is easy and strongly related to e^U. We estimate β* from the same sample using the sample covariance and variance.

Python Control variate for exp(U)

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

For this problem the exact coefficient is β* = Cov(e^U, U)/Var(U) = (1 − (e − 1)/2) / (1/12) ≈ 1.69. Your sample estimate should be close.

Measuring the gain

Because β is estimated from the same data, the estimator is very slightly biased (the bias shrinks like 1/N). In practice it is negligible. We repeat both estimators many times to see the spread, and compare the observed reduction with the theory 1 − ρ².

Python Observed variance vs the 1 - rho^2 rule

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Choosing a good control

  • Strong correlation. The whole gain comes from ρ². Pick a quantity that moves with your target.
  • Known mean. The mean must be exactly known, not estimated.
  • Cheap to compute. It should reuse the same random draw.
  • Several controls. You can use many at once: regress X on the controls and subtract the fitted part. The gain is then 1 − R² of that regression.

Typical controls in finance are the stock price itself (its mean under the model is known) or the payoff of a simpler option with a closed-form price. In a queueing simulation a control can be the total service time, whose mean you know from the input distribution.

Control variates and regression are the same idea. If you already know how to fit a line, the estimate of μ is just the intercept of the regression of X on C − c.

Check your understanding

Quick check · 4 questions

of 4 answered You scored / 4 · perfect!

  1. 1. What must be true about the control variate C?

    The known mean makes the correction unbiased, and correlation with X makes it effective.
  2. 2. With the best coefficient, the variance becomes:

    Plugging beta* = Cov/Var(C) gives Var(X)(1 - rho^2).
  3. 3. A control with correlation -0.9 with X removes about what fraction of the variance?

    rho^2 = 0.81, and only the size of the correlation matters, not its sign.
  4. 4. Why is the estimator with an estimated beta slightly biased?

    Using the same data to choose beta and to correct X creates a small dependence; the bias shrinks like 1/N.

Summary

  • A control variate C with known mean c gives the unbiased estimator X − β(C − c).
  • The best coefficient is β* = Cov(X, C)/Var(C), leaving variance Var(X)(1 − ρ²).
  • Strong correlation is everything; several controls act like a regression.
  • Estimate β from the sample, and verify the gain by repeating the experiment.

Next: Importance Sampling