integrate2_normal: 2-dimensional Gaussian Expectation

View source: R/integrate2_normal.R

integrate2_normalR Documentation

2-dimensional Gaussian Expectation

Description

Expected value of a function of two independent standard Gaussian variables

Usage

integrate2_normal(f, ...)

Arguments

f

Function to integrate over. Input to f should be a length 2 vector.

...

Additional arguments to hcubature

Value

A numeric value

\int \int f(x, y) \varphi(x) \varphi(y) dx dy,

where \varphi(\cdot) is the standard Gaussian density.

Examples

## Not run: 
# Second moment of a Gaussian
# tol = 0.0001, true value = 2, evaluated = 2.000001
f <- function(x) x[1]^2 + x[2]^2
integrate2_normal(f, tol = 1e-4)

## End(Not run)

zq00/glmhd documentation built on April 7, 2023, 7:45 a.m.