Monte Carlo Integration with a normal distribution
Monte Carlo Integration with a normal distribution.
mci(fun, R = 10^6)
fun |
A function denoting the inside part of the expectation to be computed. |
R |
The number of draws from the normal distribution. |
The result of the integral.
Michail Tsagris
R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.
Morgan B. J. (2018). Elements of simulation. Chapman & Hall/CRC.
## compute the expectation of abs(x) fun <- function(x) abs(x) mci(fun, R = 10^5) a <- function(x) abs(x) * dnorm(x) integrate(a, -Inf, Inf)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.