Numerical methods. Note 12
[~Home~] Monte Carlo Integration II. Stratified Sampling. Numerical Methods. Note~ « 12 »

Stratified sampling. This algorithm tries to distribute more points to those regions where the variance is largest. The MISER routine implements recursive stratified sampling along the following lines:

if the number of given points is too small call plain montecarlo and return
sample a fraction (Ntrial) of given points randomly from the given volume
for each dimension:
	subdivide the volume into two subvolumes (left and right) along this dimension
	estimate the (sub)variances in the two subvolumes
pick the dimension whith the largest (sub)variance
subdivide your volume in two along this dimension
distribute the remaining points between the two subvolumes proportional to (sub)variances (Nleft and Nright)
dispatch two recursive calls to each of the sub-volumes
estimate the grand average and grand variance:
	grand_average = (Ntrial*trial_average+Nleft*left_average+Nright*right_average)/(Ntrial+Nleft+Nright)
return

Quasi-Random (Low-discrepancy) sampling. Lattices. The idea of the quasi-random sampling is to distribute points "more uniformly" than in random sampling thus (hopefully) reducing the error. One of the quasi-random methods is lattices, which can be considered as a grid with non-orthogonal axes. Let αk, k=1:n be a set of (wisely chosen) irrational numbers. Then the i-th point is generated as

xi = { frac(i α1), ... , frac(i αn) },
where frac(z) denotes the fractional part of z. The problem with this method is that a high accuracy arithmetics is needed in order to generate a reasonable amount of quasi-random numbers.

Problems

  1. (non-obligatory) Implement the recursive stratified sampling routine. The routine should calculate the average and the variance for a given function in multi dimensions over a given rectangular volume.
  2. Try combinations of plain and stratified sampling with lattices and see whether this improves things.
  3. Calculate 0π dx/π~0π dy/π~0π dz/π (1-cos(x)cos(y)cos(z))-1~=~Γ(1/4)4/(4π3) ≈  1.3932039296856768591842462603255

"Copyleft" © 2004 D.V.Fedorov (fedorov at phys dot au dot dk)