NUMERICAL METHODS
averaged:
t=
1
n
∑n
i=1
f(ξi). (27.49)
Stratified sampling
Here the range ofxis broken up intoksubranges,
0=α 0 <α 1 <···<αk=1,
and crude Monte Carlo evaluation is carried out in each subrange. The estimate
E[t] is then calculated as
E[t]=
∑k
j=1
∑nj
i=1
αj−αj− 1
nj
f
(
αj− 1 +ξij(αj−αj− 1 )
)
. (27.50)
This is an unbiased estimator ofθwith variance
σt^2 =
∑k
j=1
αj−αj− 1
nj
∫αj
αj− 1
[f(x)]^2 dx−
∑k
j=1
1
nj
[∫
αj
αj− 1
f(x)dx
] 2
.
This variance can be made less than that for crude Monte Carlo, whilst using
the same total number of random numbers,n=
∑
nj, if the differences between
the average values off(x) in the various subranges are significantly greater than
the variations infwithin each subrange. It is easier administratively to make all
subranges equal in length, but better, if it can be managed, to make them such
that the variations infare approximately equal in all the individual subranges.
Importance sampling
Although we cannot integratef(x) analytically – we would not be using Monte
Carlo methods if we could – if we can find another functiong(x)thatcanbe
integrated analytically and mimics the shape offthen the variance in the estimate
ofθcan be reduced significantly compared with that resulting from the use of
crude Monte Carlo evaluation.
∫Firstly, if necessary the functiongmust be renormalised, so thatG(x)=
x
0 g(y)dyhas the propertyG(1) = 1. Clearly, it also has the propertyG(0) = 0.
Then, since
θ=
∫ 1
0
f(x)
g(x)
dG(x),
it follows that finding the expectation value off(η)/g(η) using a random number
η, distributed in such a way thatξ=G(η) is uniformly distributed on (0,1), is
equivalent to estimatingθ. This involves being able to find the inverse function
ofG; a discussion of how to do this is given towards the end of this subsection.
Ifg(η) mimicsf(η) well,f(η)/g(η) will be nearly constant and the estimation