ñòð. 1 |

â€¢ Suppose there is another function g(u) that

resembles f(u) but simpler for which I can

compute the integral. Use it to improve the

Monte Carlo integration of f.

1 1 1

âˆ« f(u)du =âˆ« g(u)du + âˆ« [ f(u) - g (u)]du

0 0 0

1

Use the known value for the first term âˆ« g(u)du

0

and estimate the second term, the difference, using Monte Carlo.

Estimator is

1

1n

âˆ« g(u)du + n âˆ‘ ( f (U i ) âˆ’ g (U i ))

i =1

0

Control variates

Estimator is

1

1n

âˆ« g(u)du + n âˆ‘ ( f (U i ) âˆ’ g (U i ))

i =1

0

VARIANCE

1

var( f (U1 ) âˆ’ g (U1 ))

n

This is better than crude if var( f (U1 ) âˆ’ g (U1 )) < var( f (U1 ))

When g (U1 ) is close to f (U1 ) variance of difference is small.

Control Variate

I tried a function of the form

g (u ) = (u âˆ’ .47) + 6(u âˆ’ .47) if u > .47

2

g (u ) = 0 if u â‰¤ .47.

This is easy to integrate since it is quadratic.

â€¢ function g=GG(u)

% control variate for callopt2.

% this function integrates to 2*(.53)^3+.53^2/2

u=max(0,u-.47);

g=6*u.^2+u;

Function GG(u) and fn(u)

â€¢ Only need to estimate the area between

the curves by Monte Carlo

Performance of Control Variate

â€¢ u= rand(1,500000);

â€¢ F=fn(u);

â€¢ G=GG(u);

â€¢ est=2*(.53)^3+.53^2/2+(F-G);

â€¢ mean(est)

â€¢ var(est)/length(est)

â€¢ (mean= 0.4616 var= 2.93e-008)

â€¢ Efficiency compared with crude 8.7e-007

ratio=30 (equivalent to 15 million crude!)

Control Variates II

The " best" approximation to f using g is not necessarily g itself.

As an alternative, we can approximate f(U) using a linear regression on g(U)

f (U ) = Î¸ + Î² ( g (U ) âˆ’ Eg (U )) + Îµ , Îµ is a mean zero " error" random variable.

1

where Î¸ = E ( f (U )) = âˆ« f(u )du

0

cov (f(U),g(U))

Slope parameter given by Î² = .

var( g (U ))

We wish to estimate the parameter Î¸ and since

Î¸ = E[ f (U ) âˆ’ Î² ( g (U ) âˆ’ Eg (U )) ] we can use a sample mean of

terms of this form, i.e.

1n

âˆ‘ [ f (U i ) âˆ’ Î² ( g (U i ) âˆ’ Eg (U i )) ] .

n i =1

1n

= Î²E ( g (U )) + âˆ‘ [ f (U i ) âˆ’ Î² ( g (U i )) ] .

n i =1

This is identical to the earlier Control Variate if Î² = 1.

However since Î² is usually unknown, we replace it by the regression

estimator of slope, equivalent to replacing variance and covariance

by sample variance and covariance .

n ___ ___

âˆ‘ [ f (U ) âˆ’ f (U )][ g (U ) âˆ’ g (U )]

i i

1n

_____

^

where g(U) = âˆ‘ g (U i ) .

Î²= i =1

___

n

n i =1

âˆ‘ [ g (U ) âˆ’ g (U )] 2

i

i =1

It is easy to show that the variance of this control estimator

1n 1n

var( Î² E ( g (U )) + âˆ‘ [ f (U i ) âˆ’ Î² ( g (U i )) ] ) = (1 âˆ’ r ) var( âˆ‘ f (U i ) )

2

n i =1 n i =1

1

so the efficiency is given by where

2

1- r

r = correlatio n coefficien t between f (U i ) and g (U i ).

Example of Control Variate II

10

x

Find âˆ« dx = E ( f ( X )) where X is U[0,10] and

(2 + x )

1/4

0

10 x

f(x) = . consider as control variate g ( x) = x.

(2+ x )

1/ 4

Note that E ( g ( X )) = E (10U ) = 5.

â€¢ x=10*rand(1,500000);

â€¢ f=10*x./(2+x.^.25); g=x; C=cov([f' g']);

â€¢ beta=C(1,2)/C(2,2); EG=5;

â€¢ est=beta*EG+f-beta*g;

â€¢ mean(est); var(est)/length(est)

â€¢ (mean= 14.000011 var= 1.8e-007)

â€¢ var(f)/500000= 2.8160e-004

â€¢ Eff=622 (equivalent to 311 million crude)

Stratified Sample

â€¢ Consider choosing one point in interval [0,a]

and another in the interval [a,1]

aU1 is in [0, a] and a + (1 âˆ’ a)U 2 is in [a,1].

Consider using a weighted average of the function at these two points

1

to estimate âˆ« f (u )du. What should the weights be?

ñòð. 1 |