You are on page 1of 10

University of Prince Edward Island

Stat 4110

Variance reduction methods.


Control Variates

University of Prince Edward Island Stat 4110


Control Variates method rationale(Basic Approach)
Suppose that we want to find θ = E (g (X )). If we know of another
"simpler" function h that is close to g , such that E (h(x)) can be
found analytically then we can write

E (g (X )) = E [g (X ) − h(X )] + E (h(X ))
Now, we can use Monte Carlo methods to find E [g (X ) − h(X )].
Because g and h are close, the random variable g (X ) − h(X ) has a
small variance, so the Monte Carlo error should be smaller than the
Monte Carlo error for g on its own.
We refer to h(X ) as a control variate for g (X ).

University of Prince Edward Island Stat 4110


Algorithm:
Assume that we have found a simple function h, and E (h(X )) is
known
1 Generate X1 , X2 , . . . Xn
Pn
(g (Xj ) − h(Xj ))
2 Find s = i=1
n
3 The estimator of θ = E (g (X )) is θnCV = s + E (h(X ))

The estimator θnCV is unbiased and


1
MSE (θnCV ) = Var (g (X ) − h(x))
n

University of Prince Edward Island Stat 4110


Example: Find an estimation of θ = E log(2U 2 + 1) where


U ∼ U[0, 1] using the control variates method.


The function g (x) = log(2x 2 + 1) satisfies that g (0) = 0 and
g (1) = log(3) ≈ 1.1.
Consider the function h(x) = x. We can see that g and h are close.
We also have that E (h(U)) = E (U) = 1/2.
Algorithm

1 Generate U1 , U2 , . . . Un ∼ U[0, 1]
n
1X
log(Uj2 + 1) − Uj

2 Find s =
n
i=1
3 Compute CV
θn = s + E (h(U)) = s + 1/2

University of Prince Edward Island Stat 4110


Code in R:

n<-1000
U < - runif ( n )
G < - log ( 2 * U ^ 2 + 1 )
BasicMCEstimator < - mean ( G )
CI < - c ( BasicMCEstimator - 1 . 9 6 * sd ( G )/ sqrt ( n ) ,
BasicMCEstimator + 1 . 9 6 * sd ( G )/ sqrt ( n ))

G 1 <- log ( 2 * U ^ 2 + 1 ) - U
CVEstimator < - mean ( G 1 )+ 0 . 5
CI 1 <-c ( CVEstimator - 1 . 9 6 * sd ( G 1 )/ sqrt ( n ) ,
CVEstimator + 1 . 9 6 * sd ( G 1 )/ sqrt ( n ))

University of Prince Edward Island Stat 4110


Control Variates Method (General Approach)
There is a more general approach to the control variates method.
As usual we are trying to estimate θ = E (g (X )),X ∼ f .
If we generate random numbers/vectors X1 , X2 , . . . Xn with
distribution
P f we can get the basic MC estimator
θ̂n = n1 nj=1 g (Xj )
Consider a function h(x) where E (h(X )) = µh is known and define
a new MC estimator that depends on a real parameter c:

θ̂nc,h = θ̂n − c(θ̂nh − µh )

where:
n
1X
θ̂nh = h(Xj )
n
j=1

University of Prince Edward Island Stat 4110


Optimal estimator
Notice that θ̂nc is unbiased and

MSE (θ̂nc,h ) = Var (θ̂n ) + c 2 Var (θ̂nh ) − 2c · cov (θ̂n , θ̂nh )

As a function of c we see that its MSE is minimized at

cov (θ̂n , θ̂nh ) Cov (g (X ), h(X ))


c0 = =
Var (θ̂nh ) Var (h(X ))

cov 2 (g (X ), h(X ))
 
  1
MSE θ̂nc0 ,h = Var (g (X )) −
n Var (h(X ))

University of Prince Edward Island Stat 4110


The relative variance reduction using control variates (compared to
the basic Monte Carlo estimator) is:

1 cov 2 (g (X ),h(X ))
MSE (θ̂nc0 ,h ) n (Var (g (X )) − Var (h(X )) )
= 1
MSE (θ̂n ) n Var (g (X ))
2
= 1 − ρ (g (X ), h(X ))

Where ρ(g (X ), h(X )) is the correlation coefficient between g (X )


and h(X ).
Remarks:
The control variates optimal estimator is not worse (it has the
same or smaller variance) than the standard Monte Carlo
estimator.
The method works better if there’s a strong correlation (either
positive or negative) between g (X ) and h(X ).

University of Prince Edward Island Stat 4110


Remarks:
The choice of c in the estimator is important, and in general
we are not able to find the optimal value c0 analytically. That
is because the quantities Var (h(X )) and cov (g (X ), h(X )) are,
in general, unknown.
An alternative is to estimate them from standard statistical
methods using an initial (relatively small) sample of size m,
and then provide an estimation of c0 as:
Pm h
j=1 (g (Xj ) − θ̂m )(h(Xj ) − θ̂n )
ĉ0 = Pm h 2
j=1 (h(Xj ) − θ̂n )

The choice c = 1 corresponds to the basic approach to the


control variate method, covered in previous slides.

University of Prince Edward Island Stat 4110


Homework:
Let θ = E (g (U)) with U ∼ U[0, 1] and g (x) = e x .
a) Find the exact value of θ.
b) Write a computer program to estimate θ using basic Monte
Carlo integration.
c) Consider h(x) = x. Find the optimal control variates Monte
Carlo estimator (essentially finding c0 theoretically)
d) Write a computer program to estimate θ using the optimal
control variates estimator from part c)
e) How much is the variance reduced by using the control
variates estimator, compared to the basic Monte Carlo
estimator in your program outcomes?
f) Does the answer to e) match the theoretical variance
reduction given by 1 − ρ2 (g (U), h(U))?

University of Prince Edward Island Stat 4110

You might also like