Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

mci

Monte Carlo Integration with a normal distribution


Description

Monte Carlo Integration with a normal distribution.

Usage

mci(fun, R = 10^6)

Arguments

fun

A function denoting the inside part of the expectation to be computed.

R

The number of draws from the normal distribution.

Value

The result of the integral.

Author(s)

Michail Tsagris

R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.

References

Morgan B. J. (2018). Elements of simulation. Chapman & Hall/CRC.

See Also

Examples

## 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)

Rfast2

A Collection of Efficient and Extremely Fast R Functions II

v0.0.9
GPL (>= 2.0)
Authors
Manos Papadakis, Michail Tsagris, Stefanos Fafalios and Marios Dimitriadis.
Initial release
2021-03-21

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.