As discussed before, in physics and statistics many of the problems Monte Carlo is used on is under the form of the estimate of an integral unkown in closed form: , which can be seen as the evalutaion of , where . There is another Monte Carlo method named mean-value Monte Carlo method. Thus proposes to generate numbers uniformly from and take their average: to estimate , .

In the animation package, the function MC.samplemean() can be used to estimate the area under the curve, by computing the average function values. Let’s me show you a quick example, see below.

library(animation)
MC.samplemean(border = NA)$est
## [1] 0.1815

Reference

1.Monte Carlo,http://www-stat.stanford.edu/~susan/courses/s208/node14.html



Published

30 April 2013

Tags