Search

Search papers and lessons

Control Variate

Level 3 · 13 min read

A control variate cuts the noise of a Monte Carlo average by subtracting a correlated quantity whose mean is known exactly, so the estimate stays unbiased while the error shrinks.

On this page

  • Colour = topic mix
  • Probability
  • Discrete math
  • Calculus
  • Sampling
  • Inference
  • ReadReady to readNot yet

TL;DR

A Monte Carlo estimate averages random samples, and its error is set by how much the samples scatter. A control variate reduces that scatter by measuring a second quantity, one that moves with the first and whose average is known exactly, and subtracting the known part of the wobble. The estimate stays unbiased, and when the two quantities are strongly correlated the error can shrink several times over with the same number of samples.

Builds on: Monte Carlo Method, Covariance, Correlation Coefficient · Leads to: Importance Sampling

Where it's used

Pricing financial options. An option's payoff depends on a random future price path, and its fair price is an expected value that is usually estimated by simulating many paths. A common trick uses an option whose price has a closed-form formula, such as a version that pays on the geometric average of the price instead of the arithmetic average. The two payoffs are highly correlated across paths, so the known formula removes much of the simulation noise. Kemna and Vorst used this idea for Asian options in 1990.

Survey sampling. A statistics office wants the average income of all households but can afford to interview only a sample. Last year's census gave the true average for every household, and that quantity is correlated with this year's income. Using last year's numbers as a control is the difference and ratio estimator tradition, developed in the mid-twentieth century for sample surveys.

Physics and engineering simulation. When a simulation is expensive, a cheap approximate model of the same system often correlates with the expensive one. Its mean is computed exactly or with many cheap runs, and it serves as the control. Each expensive run then needs fewer repetitions to reach a target error.

How it works

Suppose we want the average of YY, and we can only learn about YY by drawing random samples. Now suppose there is a second quantity ZZ that comes from the same draw, has a mean μZ\mu_Z we know exactly, and tends to be high when YY is high. Here is one pass of the estimator on four samples, traced from start to finish. The known mean is μZ=0.5\mu_Z = 0.5.

  1. Draw four pairs (Z,Y)(Z, Y). The samples are (1,0.6)(1, 0.6), (1,0.8)(1, 0.8), (1,0.5)(1, 0.5), and (0,0.3)(0, 0.3). Check: each row has one ZZ and one YY, and both come from the same random draw.

  2. Average YY the plain way. Yˉ=(0.6+0.8+0.5+0.3)/4=0.55\bar{Y} = (0.6 + 0.8 + 0.5 + 0.3)/4 = 0.55. Check: this is the standard Monte Carlo estimate, and it is unbiased.

  3. Compare the sample of ZZ with its known mean. Zˉ=(1+1+1+0)/4=0.75\bar{Z} = (1 + 1 + 1 + 0)/4 = 0.75, but the true mean is 0.5. The sample happened to draw too many Z=1Z = 1 cases. Those cases come with higher YY values, so the plain average of YY is probably too high. Check: the gap Zˉ−μZ=0.25\bar{Z} - \mu_Z = 0.25 is the sign of the error we want to remove.

  4. Subtract the known part of the gap. Pick a number c=0.5c = 0.5 and form Y^c=Yˉ−c(Zˉ−μZ)=0.55−0.5×0.25=0.425\hat{Y}_c = \bar{Y} - c(\bar{Z} - \mu_Z) = 0.55 - 0.5 \times 0.25 = 0.425. Check: the correction moved the estimate down, in the direction the gap suggested.

  5. Confirm that the correction does not bias the answer. The average of Zˉ−μZ\bar{Z} - \mu_Z over many repeats is zero, because Zˉ\bar{Z} is unbiased for μZ\mu_Z and the law of large numbers makes repeated averages settle on the mean. So the expected value of Y^c\hat{Y}_c is still the true average of YY, whatever cc is. Check: a different cc changes the noise, not the target.

  6. Choose cc to make the noise as small as possible. The best cc depends on how strongly YY and ZZ move together, and the next section gives the formula. The result is an average whose scatter is smaller than the plain average's, for the same number of samples.

The diagram shows the same flow.

flowchart LR
  A[Draw samples of Z and Y together] --> B[Average Y: plain estimate]
  A --> C[Average Z and compare with its known mean]
  B --> D[Subtract c times the gap]
  C --> D
  D --> E[Unbiased estimate with less scatter]

How much help the control gives depends on the correlation. The plot shows, as a function of the correlation ρ\rho between YY and ZZ, the factor by which the variance is multiplied (solid) and the factor for the standard error (dashed).

−1−0.500.5100.20.40.60.81correlation rhofactor
  • variance factor
  • standard error factor
With correlation 0.9 the variance is cut to 19 percent of the plain value, so the standard error is about 44 percent of the plain one.

The math

Definition: Control variate estimator

Let Y1,…,YnY_1, \dots, Y_n and Z1,…,ZnZ_1, \dots, Z_n be paired samples, each pair drawn from the same random experiment, with expected value E[Y]=μ\mathbb{E}[Y] = \mu unknown and E[Z]=μZ\mathbb{E}[Z] = \mu_Z known. For a constant cc, the control variate estimator is

μ^c=Yˉ−c (Zˉ−μZ),Yˉ=1n∑i=1nYi,Zˉ=1n∑i=1nZi.\hat{\mu}_c = \bar{Y} - c\,(\bar{Z} - \mu_Z), \qquad \bar{Y} = \frac{1}{n}\sum_{i=1}^{n} Y_i, \qquad \bar{Z} = \frac{1}{n}\sum_{i=1}^{n} Z_i.

The number cc is the coefficient, and ZZ is the control.

In words: Yˉ\bar{Y} is the plain average, Zˉ\bar{Z} is the average of the control, and the estimate adds back a multiple of the control's sampling error.

Step 1 in symbols: the estimate is unbiased

Since E[Zˉ]=μZ\mathbb{E}[\bar{Z}] = \mu_Z, the term Zˉ−μZ\bar{Z} - \mu_Z has expected value zero. Therefore

E[μ^c]=E[Yˉ]−c (E[Zˉ]−μZ)=μ−c⋅0=μ.\mathbb{E}[\hat{\mu}_c] = \mathbb{E}[\bar{Y}] - c\,\big(\mathbb{E}[\bar{Z}] - \mu_Z\big) = \mu - c \cdot 0 = \mu.

This holds for every cc, which is why the choice of cc affects only the noise.

Step 2 in symbols: the variance

Rewrite the estimate as one average, then take its variance, which involves the covariance of YY and ZZ: μ^c=1n∑i(Yi−cZi)+c μZ\hat{\mu}_c = \frac{1}{n}\sum_i (Y_i - c Z_i) + c\,\mu_Z. The c μZc\,\mu_Z term is a constant, so

Var⁡(μ^c)=1nVar⁡(Y−cZ)=1n(Var⁡(Y)−2c Cov⁡(Y,Z)+c2Var⁡(Z)).\operatorname{Var}(\hat{\mu}_c) = \frac{1}{n}\operatorname{Var}(Y - cZ) = \frac{1}{n}\Big(\operatorname{Var}(Y) - 2c\,\operatorname{Cov}(Y, Z) + c^2 \operatorname{Var}(Z)\Big).

This is a quadratic in cc, so it has one smallest value.

Step 3 in symbols: the best coefficient

Set the derivative with respect to cc to zero: −2Cov⁡(Y,Z)+2cVar⁡(Z)=0-2\operatorname{Cov}(Y, Z) + 2c\operatorname{Var}(Z) = 0, so

c∗=Cov⁡(Y,Z)Var⁡(Z).c^{*} = \frac{\operatorname{Cov}(Y, Z)}{\operatorname{Var}(Z)}.

This is the slope of the regression of YY on ZZ. Substituting back, and writing ρ\rho for the correlation coefficient between YY and ZZ, the smallest variance is

Var⁡(μ^c∗)=Var⁡(Y)n (1−ρ2).\operatorname{Var}(\hat{\mu}_{c^{*}}) = \frac{\operatorname{Var}(Y)}{n}\,\big(1 - \rho^2\big).

The factor 1−ρ21 - \rho^2 is the whole story: the closer ρ\rho is to 11 or −1-1, the more of the noise is removed. The sign of ρ\rho does not matter, because cc takes the sign it needs.

Step 4 in symbols: estimating cc from data

In practice Cov⁡(Y,Z)\operatorname{Cov}(Y, Z) and Var⁡(Z)\operatorname{Var}(Z) are estimated from the same samples. This adds a small bias that shrinks as 1/n1/n, and it is ignored in most applications with many samples. Estimating cc from a separate pilot run avoids the issue.

Worked examples

Example
1. A small hand-computed correction

Take n=4n = 4 and the pairs (Z,Y)(Z, Y): (1,0.9)(1, 0.9), (1,0.8)(1, 0.8), (1,0.7)(1, 0.7), (0,0.2)(0, 0.2). The known mean is μZ=0.5\mu_Z = 0.5, and we use c=1c = 1.

  1. Average the YY values: (0.9+0.8+0.7+0.2)/4=2.6/4=0.65(0.9 + 0.8 + 0.7 + 0.2)/4 = 2.6/4 = 0.65.
  2. Average the ZZ values: (1+1+1+0)/4=0.75(1 + 1 + 1 + 0)/4 = 0.75.
  3. Gap from the known mean: 0.75−0.5=0.250.75 - 0.5 = 0.25.
  4. Correction: c×0.25=0.25c \times 0.25 = 0.25.
  5. Estimate: 0.65−0.25=0.400.65 - 0.25 = 0.40.

Interpretation: the sample had more Z=1Z = 1 cases than expected, and those carry high YY values, so the plain average of 0.65 was pushed up. The estimate moves to 0.40. With c=1c = 1 this is not the best choice of cc, but the estimate is still unbiased.

Example
2. The standard case with known variances

Let Var⁡(Y)=4\operatorname{Var}(Y) = 4, Var⁡(Z)=1\operatorname{Var}(Z) = 1, and Cov⁡(Y,Z)=1.8\operatorname{Cov}(Y, Z) = 1.8. Then ρ=1.8/4×1=0.9\rho = 1.8 / \sqrt{4 \times 1} = 0.9.

  1. Best coefficient: c∗=1.8/1=1.8c^{*} = 1.8 / 1 = 1.8.
  2. Plain variance per sample: Var⁡(Y)=4\operatorname{Var}(Y) = 4.
  3. Controlled variance per sample: 4−2(1.8)(1.8)+(1.8)2(1)=4−6.48+3.24=0.764 - 2(1.8)(1.8) + (1.8)^2(1) = 4 - 6.48 + 3.24 = 0.76.
  4. Check with the formula: 4(1−0.81)=4×0.19=0.764(1 - 0.81) = 4 \times 0.19 = 0.76. The two agree.
  5. With n=1000n = 1000 samples, the plain standard error is 4/1000≈0.063\sqrt{4/1000} \approx 0.063, and the controlled one is 0.76/1000≈0.028\sqrt{0.76/1000} \approx 0.028.

Interpretation: the same 1000 draws give an estimate less than half as noisy. Equivalently, the plain method would need about 4/0.76≈5.34/0.76 \approx 5.3 times as many samples to match the controlled estimate.

Example
3. A household-energy survey (realistic)

A city wants the mean monthly electricity use, in kWh, of all its households. The census of last year gives a true mean of 300 kWh for last year's use, so μZ=300\mu_Z = 300. A sample of n=400n = 400 households this year gives Yˉ=320\bar{Y} = 320 kWh and last year's sample mean Zˉ=290\bar{Z} = 290 kWh. Both standard deviations are about 100 kWh, and the correlation between this year's and last year's use across households is about ρ=0.8\rho = 0.8.

  1. The gap is Zˉ−μZ=290−300=−10\bar{Z} - \mu_Z = 290 - 300 = -10. The sample used a little less electricity last year than the city as a whole.
  2. Best coefficient: c∗=ρ σY/σZ=0.8×100/100=0.8c^{*} = \rho\,\sigma_Y / \sigma_Z = 0.8 \times 100 / 100 = 0.8.
  3. Adjusted estimate: 320−0.8×(−10)=320+8=328320 - 0.8 \times (-10) = 320 + 8 = 328 kWh.
  4. Plain standard error: σY/n=100/20=5\sigma_Y / \sqrt{n} = 100 / 20 = 5 kWh.
  5. Adjusted standard error: (1−0.64)×5=0.6×5=3\sqrt{(1 - 0.64)} \times 5 = 0.6 \times 5 = 3 kWh.

Interpretation: the sample looked low on last year's use, which suggests it was also low this year, so the estimate moves up to 328. The margin of error drops from about 5 to about 3 kWh for the same survey.

Try it: suppose the correlation were only ρ=0.6\rho = 0.6, with everything else the same. Compute the adjusted standard error. Answer: 1−0.36×5=0.8×5=4\sqrt{1 - 0.36} \times 5 = 0.8 \times 5 = 4 kWh, still better than 5 kWh but a much smaller gain.

Common mistakes and tradeoffs

It is tempting to think that subtracting something makes the estimate biased. In fact the control has known mean, so its sampling error averages to zero, and μ^c\hat{\mu}_c is unbiased for every cc. The only cost is the small bias from estimating cc on the same data, which shrinks with nn.

It is tempting to think any correlated variable helps. In fact the gain is the factor 1−ρ21 - \rho^2, so a control with ρ\rho near zero does almost nothing. A control with a strong negative correlation helps just as much, because cc becomes negative.

It is tempting to think the control only needs a rough mean. In fact the method needs the control's mean to be known exactly. If you estimate μZ\mu_Z from the same samples, most of the variance reduction disappears, so the control must come from a formula or a much larger independent computation.

When to use it: you have a cheap quantity that tracks the one you want, with a mean you know exactly, and the correlation is high. It is the standard first tool when a plain Monte Carlo estimate is too noisy.

When not to use it: no such control exists, the correlation is weak, or computing the control costs about as much as the samples you were trying to save.

TechniqueIdeaStrengthWeakness
Control variateSubtract a correlated known-mean quantityUnbiased, often large gainsNeeds a good control with exact mean
Importance samplingSample from a different distribution and reweightFocuses effort on rare, important outcomesWeights can become huge
Antithetic variatesPair each draw with its mirror imageSimple, no extra modelGains depend on monotone behaviour
Stratified samplingSplit the range and sample each partRemoves between-part variationNeeds a way to split the range

History

The Monte Carlo method took shape at Los Alamos in the 1940s, when Stanislaw Ulam and John von Neumann proposed estimating quantities by random sampling and the computers of the day made it practical. Early users quickly needed ways to make estimates less noisy with a fixed budget of runs.

The control idea is older than the computer. Survey statisticians used auxiliary information, such as last census's totals, through ratio and difference estimators, and William Cochran's 1953 textbook Sampling Techniques is a standard reference for them. Simulation specialists later adopted the same estimator for random experiments. It caught on in finance in the 1990s, when pricing exotic options by simulation became routine and a closed-form control was often available.

Recap

  • A Monte Carlo average has noise set by the spread of its samples, and the usual standard error shrinks like one over the square root of the sample count.
  • A control variate ZZ is a quantity drawn alongside YY whose mean μZ\mu_Z is known exactly.
  • The estimate Yˉ−c(Zˉ−μZ)\bar{Y} - c(\bar{Z} - \mu_Z) stays unbiased for every cc.
  • The best cc is Cov⁡(Y,Z)/Var⁡(Z)\operatorname{Cov}(Y, Z) / \operatorname{Var}(Z), which yields variance Var⁡(Y)(1−ρ2)/n\operatorname{Var}(Y)(1 - \rho^2) / n.
  • Strong correlation with a known-mean control is what makes the method pay off.

Read next: Importance Sampling, which reduces variance in a different way by changing the distribution you sample from.

Check yourself

QuestionWhat property must a control variate Z have for the estimate Y-bar minus c times (Z-bar minus mu_Z) to stay unbiased?Show answer

Its mean μZ\mu_Z must be known exactly. Then E[Zˉ−μZ]=0\mathbb{E}[\bar{Z} - \mu_Z] = 0 for every sample size, so the correction has zero expected value and the estimate is unbiased for any choice of cc.

QuestionY has variance 9, Z has variance 4, and Cov(Y, Z) = 3. What is the best coefficient c, and what fraction of the plain variance remains?Show answer

The best coefficient is c∗=3/4=0.75c^{*} = 3 / 4 = 0.75. The correlation is ρ=3/9×4=3/6=0.5\rho = 3 / \sqrt{9 \times 4} = 3 / 6 = 0.5, so the remaining fraction is 1−ρ2=1−0.25=0.751 - \rho^2 = 1 - 0.25 = 0.75. Check: 9−32/4=9−2.25=6.75=0.75×99 - 3^2 / 4 = 9 - 2.25 = 6.75 = 0.75 \times 9.

QuestionWhy does the sign of the correlation not matter for the size of the gain, even though it matters for the sign of c?Show answer

The gain depends on ρ2\rho^2, which is the same for a positive and a negative correlation. The coefficient c∗=Cov⁡(Y,Z)/Var⁡(Z)c^{*} = \operatorname{Cov}(Y, Z) / \operatorname{Var}(Z) takes the sign that lines the correction up with the error, so a negatively correlated control is subtracted with a negative cc, which is the same as adding it back. Either way the removed variance is Var⁡(Y)ρ2/n\operatorname{Var}(Y)\rho^2 / n.

QuestionA team estimates an average with a plain simulation and wants a control. They propose using a cheap approximate model whose mean they estimate from 10 extra runs. What is the main risk, and what would you check?Show answer

The mean of the control is estimated, not known exactly, so its sampling error no longer averages to zero by construction, and most of the variance reduction can be lost. Check the correlation between the approximate model and the target on the main runs, and either compute the control's mean with far more runs or find a control with an exact formula. A pilot run to estimate cc separately is also advisable.

Sources