Monte Carlo Integration
Monte Carlo Integration
Overview
In numerical integration, methods such as the trapezoidal rule use a deterministic
approach. Monte Carlo integration, on the other hand, employs a non-deterministic
approach: each realization provides a different outcome. In Monte Carlo, the final outcome
is an approximation of the correct value with respective error bars, and the correct value is
likely to be within those error bars.
The problem Monte Carlo integration addresses the computation of a multidimensional
definite integral
The naive Monte Carlo approach is to sample points uniformly on Ω:[4] given N uniform
samples,
I can be approximated by
Given the estimation of I from QN, the error bars of QN can be estimated by the sample
variance using the unbiased estimate of the variance.
which leads to
is bounded, this variance decreases asymptotically to zero as 1/N. The estimation of the
error of QN is thus
which decreases as . This is standard error of the mean multiplied with . This result
does not depend on the number of dimensions of the integral, which is the promised
advantage of Monte Carlo integration against most deterministic methods that depend
exponentially on the dimension.[5] It is important to notice that, unlike in deterministic
methods, the estimate of the error is not a strict error bound; random sampling may not
uncover all the important features of the integrand that can result in an underestimate of
the error.
While the naive Monte Carlo works for simple examples, an improvement over
deterministic algorithms only can be accomplished with algorithms that use problem
specific sampling distributions. With an appropriate sample distribution it is possible to
exploit the fact that almost all higher-dimensional integrands are very localized and only
small subspace notably contributes to the integral[6]. A large part of the Monte Carlo
literature is dedicated in developing strategies to improve the error estimates. In particular,
stratified sampling—dividing the region in sub-domains—, and importance sampling—
sampling from non-uniform distributions—are two of such techniques.
Example
Thus, a crude way of calculating the value of π with Monte Carlo integration is to pick N
random numbers on Ω and compute
In the figure on the right, the relative error is measured as a function of N,
confirming the .
C example
srand(time(NULL));
pi = 4 * (circleDarts/throws);
is given by,
It can be shown that this variance is minimized by distributing the points such that,
Hence the smallest error estimate is obtained by allocating sample points in proportion to
the standard deviation of the function in each sub-region.
The MISER algorithm proceeds by bisecting the integration region along one coordinate
axis to give two sub-regions at each step. The direction is chosen by examining all d possible
bisections and selecting the one which will minimize the combined variance of the two sub-
regions. The variance in the sub-regions is estimated by sampling with a fraction of the total
number of points available to the current step. The same procedure is then repeated
recursively for each of the two half-spaces from the best bisection. The remaining sample
points are allocated to the sub-regions using the formula for Na and Nb. This recursive
allocation of integration points continues down to a user-specified depth where each sub-
region is integrated using a plain Monte Carlo estimate. These individual values and their
error estimates are then combined upwards to give an overall result and an estimate of its
error.
Importance sampling
There are a variety of importance sampling algorithms, such as
Consider the following example where one would like to numerically integrate a gaussian
function, centered at 0, with σ = 1, from −1000 to 1000. Naturally, if the samples are drawn
uniformly on the interval [−1000, 1000], only a very small part of them would be significant
to the integral. This can be improved by choosing a different distribution from where the
samples are chosen, for instance by sampling according to a gaussian distribution centered
at 0, with σ = 1. Of course the "right" choice strongly depends on the integrand.
Intuitively, this says that if we pick a particular sample twice as much as other samples, we
weight it half as much as the other samples. This estimator is naturally valid for uniform
sampling, the case where is constant.
The Metropolis-Hastings algorithm is one of the most used algorithms to generate from
,[3] thus providing an efficient way of computing integrals.
The VEGAS algorithm approximates the exact distribution by making a number of passes
over the integration region which creates the histogram of the function f. Each histogram is
used to define a sampling distribution for the next pass. Asymptotically this procedure
converges to the desired distribution.[17] In order to avoid the number of histogram bins
growing like Kd, the probability distribution is approximated by a separable function:
so that the number of bins required is only Kd. This is equivalent to locating the peaks of
the function from the projections of the integrand onto the coordinate axes. The efficiency
of VEGAS depends on the validity of this assumption. It is most efficient when the peaks of
the integrand are well-localized. If an integrand can be rewritten in a form which is
approximately separable this will increase the efficiency of integration with VEGAS. VEGAS
incorporates a number of additional features, and combines both stratified sampling and
importance sampling.[17]
See also
◾ Auxiliary field Monte Carlo
◾ Monte Carlo method in statistical physics
◾ Monte Carlo method
◾ Variance reduction
Notes
1. Press et al, 2007, Chap. 4.
2. Press et al, 2007, Chap. 7.
3. Newman, 1999, Chap. 2.
4. Newman, 1999, Chap. 1.
5. Press et al, 2007
6. MacKay, David (2003). "chapter 4.4 Typicality & chapter 29.1" (http://www.inference.org.
uk/itprnn/book.pdf) (PDF). Information Theory, Inference and Learning Algorithms (htt
p://www.inference.phy.cam.ac.uk/mackay/itila/book.html). Cambridge University Press.
pp. 284–292. ISBN 978-0-521-64298-9. MR 2012999 (https://www.ams.org/mathscinet-
getitem?mr=2012999).
7. Press, 1990, pp 190-195.
8. Kroese, D. P.; Taimre, T.; Botev, Z. I. (2011). Handbook of Monte Carlo Methods. John
Wiley & Sons.
9. Veach, Eric; Guibas, Leonidas J. (1995-01-01). Optimally Combining Sampling
Techniques for Monte Carlo Rendering10.1145/218380.218498 (https://archive.org/detai
ls/computergraphics00sigg/page/419). Proceedings of the 22Nd Annual Conference on
Computer Graphics and Interactive Techniques. SIGGRAPH '95. New York, NY, USA.
pp. 419–428 (https://archive.org/details/computergraphics00sigg/page/419).
CiteSeerX 10.1.1.127.8105 (https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.
127.8105). doi:10.1145/218380.218498 (https://doi.org/10.1145%2F218380.218498).
ISBN 978-0-89791-701-8.
10. Owen, Art; Associate, Yi Zhou (2000-03-01). "Safe and Effective Importance Sampling".
Journal of the American Statistical Association. 95 (449): 135–143.
CiteSeerX 10.1.1.36.4536 (https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.3
6.4536). doi:10.1080/01621459.2000.10473909 (https://doi.org/10.1080%2F01621459.
2000.10473909). ISSN 0162-1459 (https://www.worldcat.org/issn/0162-1459).
11. Elvira, V.; Martino, L.; Luengo, D.; Bugallo, M.F. (2015-10-01). "Efficient Multiple
Importance Sampling Estimators". IEEE Signal Processing Letters. 22 (10): 1757–1761.
arXiv:1505.05391 (https://arxiv.org/abs/1505.05391). Bibcode:2015ISPL...22.1757E (htt
ps://ui.adsabs.harvard.edu/abs/2015ISPL...22.1757E). doi:10.1109/LSP.2015.2432078
(https://doi.org/10.1109%2FLSP.2015.2432078). ISSN 1070-9908 (https://www.worldca
t.org/issn/1070-9908).
12. Cappé, O.; Guillin, A.; Marin, J. M.; Robert, C. P. (2004-12-01). "Population Monte
Carlo". Journal of Computational and Graphical Statistics. 13 (4): 907–929.
doi:10.1198/106186004X12803 (https://doi.org/10.1198%2F106186004X12803).
ISSN 1061-8600 (https://www.worldcat.org/issn/1061-8600).
13. Cappé, Olivier; Douc, Randal; Guillin, Arnaud; Marin, Jean-Michel; Robert, Christian P.
(2008-04-25). "Adaptive importance sampling in general mixture classes". Statistics and
Computing. 18 (4): 447–459. arXiv:0710.4242 (https://arxiv.org/abs/0710.4242).
doi:10.1007/s11222-008-9059-x (https://doi.org/10.1007%2Fs11222-008-9059-x).
ISSN 0960-3174 (https://www.worldcat.org/issn/0960-3174).
14. Cornuet, Jean-Marie; Marin, Jean-Michel; Mira, Antonietta; Robert, Christian P. (2012-
12-01). "Adaptive Multiple Importance Sampling". Scandinavian Journal of Statistics. 39
(4): 798–812. arXiv:0907.1254 (https://arxiv.org/abs/0907.1254). doi:10.1111/j.1467-
9469.2011.00756.x (https://doi.org/10.1111%2Fj.1467-9469.2011.00756.x). ISSN 1467-
9469 (https://www.worldcat.org/issn/1467-9469).
15. Martino, L.; Elvira, V.; Luengo, D.; Corander, J. (2015-08-01). "An Adaptive Population
Importance Sampler: Learning From Uncertainty". IEEE Transactions on Signal
Processing. 63 (16): 4422–4437. Bibcode:2015ITSP...63.4422M (https://ui.adsabs.harv
ard.edu/abs/2015ITSP...63.4422M). CiteSeerX 10.1.1.464.9395 (https://citeseerx.ist.ps
u.edu/viewdoc/summary?doi=10.1.1.464.9395). doi:10.1109/TSP.2015.2440215 (https://
doi.org/10.1109%2FTSP.2015.2440215). ISSN 1053-587X (https://www.worldcat.org/iss
n/1053-587X).
16. Bugallo, Mónica F.; Martino, Luca; Corander, Jukka (2015-12-01). "Adaptive importance
sampling in signal processing". Digital Signal Processing. Special Issue in Honour of
William J. (Bill) Fitzgerald. 47: 36–49. doi:10.1016/j.dsp.2015.05.014 (https://doi.org/10.
1016%2Fj.dsp.2015.05.014).
17. Lepage, 1978
References
◾ Caflisch, R. E. (1998). "Monte Carlo and quasi-Monte Carlo methods". Acta Numerica.
7: 1–49. Bibcode:1998AcNum...7....1C (https://ui.adsabs.harvard.edu/abs/1998AcNu
m...7....1C). doi:10.1017/S0962492900002804 (https://doi.org/10.1017%2FS096249290
0002804).
◾ Weinzierl, S. (2000). "Introduction to Monte Carlo methods". arXiv:hep-ph/0006269 (http
s://arxiv.org/abs/hep-ph/0006269).
◾ Press, W. H.; Farrar, G. R. (1990). "Recursive Stratified Sampling for Multidimensional
Monte Carlo Integration". Computers in Physics. 4 (2): 190.
Bibcode:1990ComPh...4..190P (https://ui.adsabs.harvard.edu/abs/1990ComPh...4..190
P). doi:10.1063/1.4822899 (https://doi.org/10.1063%2F1.4822899).
◾ Lepage, G. P. (1978). "A New Algorithm for Adaptive Multidimensional Integration".
Journal of Computational Physics. 27 (2): 192–203. Bibcode:1978JCoPh..27..192L (http
s://ui.adsabs.harvard.edu/abs/1978JCoPh..27..192L). doi:10.1016/0021-
9991(78)90004-9 (https://doi.org/10.1016%2F0021-9991%2878%2990004-9).
◾ Lepage, G. P. (1980). "VEGAS: An Adaptive Multi-dimensional Integration Program".
Cornell Preprint CLNS 80-447.
◾ Hammersley, J. M.; Handscomb, D. C. (1964). Monte Carlo Methods. Methuen.
ISBN 978-0-416-52340-9.
◾ Press, WH; Teukolsky, SA; Vetterling, WT; Flannery, BP (2007). Numerical Recipes: The
Art of Scientific Computing (3rd ed.). New York: Cambridge University Press. ISBN 978-
0-521-88068-8.
◾ Newman, MEJ; Barkema, GT (1999). Monte Carlo Methods in Statistical Physics.
Clarendon Press.
◾ Robert, CP; Casella, G (2004). Monte Carlo Statistical Methods (2nd ed.). Springer.
ISBN 978-1-4419-1939-7.
External links
◾ Café math : Monte Carlo Integration (https://web.archive.org/web/20140202110318/htt
p://www.cafemath.fr/mathblog/article.php?page=MonteCarlo.php) : A blog article
describing Monte Carlo integration (principle, hypothesis, confidence interval)
◾ Boost.Math : Naive Monte Carlo integration: Documentation for the C++ naive Monte-
Carlo routines (http://www.boost.org/doc/libs/release/libs/math/doc/html/math_toolkit/nai
ve_monte_carlo.html)
◾ Monte Carlo applet applied in statistical physics problems (https://sites.google.com/vie
w/chremos-group/applets/monte-carlo:)
Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By
using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the
Wikimedia Foundation, Inc., a non-profit organization.