Description Usage Arguments Value Functions Examples
Calculate the expected value of f(X) with X~N(mu, sigma)
1 2 3 4 5 6 7 8 9 | expect_norm_gq(fun, dimensions = 1, mu = rep(0, dimensions),
sigma = diag(1, dimensions), settings = settings.gq(), ...)
expect_norm_mc(fun, dimensions, mu = rep(0, dimensions),
sigma = diag(1, dimensions), settings = settings.mc(), ...)
settings.gq(quad_points = 5)
settings.mc(n_samples = 1000, seed = 123)
|
fun |
Function to integrate |
dimensions |
Number of dimensions of X |
mu |
Mean of X |
sigma |
Variance of X |
settings |
Settings |
... |
Arguments to f |
Numeric value of the integral
expect_norm_gq
: Calculation using Gaussian quadrature
expect_norm_mc
: Calculation using Monte-Carlo sampling
1 2 | f <- function(x) x^2
expect_norm_gq(f)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.