emblem
Monte Carlo integration
Integrates via Monte Carlo: simple and importance sampling.
2024.Jul.03 18:21:35
x1, x2 Limits of integration. •
lgN, .seed (lg) N. of trials, random no. gener. seed. •
Show values Shows the coordinates of the graph. •

Integrates, via the Monte Carlo technique, a univariate function, in this case the standard Gaussian, between the given limits of integration, x1 and x2, using both the simple version of the technique and importance sampling. This latter is of interest when some regions of the integrand have very small values, as is the case of the Gaussian tail.

The "simple" version computes the integral, I, just by accumulating values of y, for x = x1 + (x2x1) r, with random uniform (0–1) r, and multiplying by the range of integrations (x2x1) divided by N, the number of trials.

"Importance sampling" assigns small weight to the regions of the integrand, y, of very small (near zero) value:

 

  1. Choose a weight function, w(x), that is (a) "similar" to y(x), (b) a 'pdf', and (c) whose 'cdf' is easily invertible.
  2. Repeat: obtain r, a random uniform (0–1).
  3. Compute xR = W−1(r) (inverse of the 'cdf').
  4. Accumulate the integral, I, with y(xR) / w(xR). Go to repeat till I is "satisfactory" (stable).

When importance sampling is convenient (as in the base case), the integral becomes stable earlier, in the course of the simulation, i.e., fewer trials would be necessary.

The analytical value of the integral and the simulated results are given, and a plot is shown for the values of two (simple and importance sampling) integrals, along the simulation trials.

Other suggested data: (4, 10)

References: Plate: MCintegrationIS

• Google: "importance sampling"

Wasserman, Larry, 2004, "All of Statistics: a concise course in statistical inference", Springer, New Yotk, NY (USA) (QA276.12.W37 2003), xix+442 pp. ISBN 0-387-40272-1, (IST Bibl.: QA276.7-.8.WAS.67200), pp 408–410, Example 24.6.

• Wikipedia "Importance sampling.

• 1919-10-10: Kruskal, William Henry (2005-04-21).

 
 
Valid HTML 4.01! IST http://web.ist.utl.pt/~ist11038/compute/or/Fx-MC-integrIS.php
Created: 2017-10-12 — Last modified: 2017-12-10