mc_integral: (Improved) Monte Carlo integration

Description Usage Arguments Details References See Also Examples

Description

Monte Carlo integral of ftn over [a, b] using a sample of size n.

Usage

1
mc_integral(ftn, a, b, n)

Arguments

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.

Details

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.

References

Owen Jones,Robert Maillardet,Andrew Robinson (2014).Introduction to Scientific Programming and Simulation Using R ; Second Edition

See Also

integral

Examples

1
2
f <- function(x) return(x^3 + 1)
mc_integral(f, 0, 1, 10000)

david850803/MC.makes.perfect documentation built on June 16, 2019, 12:04 a.m.