Description Usage Arguments Details References See Also Examples
Monte Carlo integral of ftn over [a, b] using a sample of size n.
1 | mc_integral(ftn, a, b, n)
|
a |
lower bound of the integration. Must be finite. |
b |
upper bound of the integration. Must be finite and assume b > a. |
n |
number of samples used in the estimation. |
When we say a Monte Carlo technique is better than another we mean that using the same number of function calls, it has smaller variance.Because our estimates are based on random samples they are themselves random variables.
Owen Jones,Robert Maillardet,Andrew Robinson (2014).Introduction to Scientific Programming and Simulation Using R ; Second Edition
1 2 | f <- function(x) return(x^3 + 1)
mc_integral(f, 0, 1, 10000)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.