gauss.hermite: Gauss-Hermite Quadrature Approximation to Expectation for...

View source: R/hermite.R

gauss.hermiteR Documentation

Gauss-Hermite Quadrature Approximation to Expectation for Normal Distribution

Description

Calculates an approximation to the expected value of any function of a normally-distributed random variable, using Gauss-Hermite quadrature.

Usage

gauss.hermite(f, mu = 0, sd = 1, ..., order = 5)

Arguments

f

The function whose moment should be approximated.

mu

Mean of the normal distribution.

sd

Standard deviation of the normal distribution.

...

Additional arguments passed to f.

order

Number of quadrature points in the Gauss-Hermite quadrature approximation. A small positive integer.

Details

This algorithm calculates the approximate expected value of f(Z) when Z is a normally-distributed random variable with mean mu and standard deviation sd. The expected value is an integral with respect to the Gaussian density; this integral is approximated using Gauss-Hermite quadrature.

The argument f should be a function in the R language whose first argument is the variable Z. Additional arguments may be passed through .... The value returned by f may be a single numeric value, a vector, or a matrix. The values returned by f for different values of Z must have compatible dimensions.

The result is a weighted average of several values of f.

Value

Numeric value, vector or matrix.

Author(s)

\adrian

, \rolf

and \ege.

Examples

  gauss.hermite(function(x) x^2, 3, 1)

spatstat.random documentation built on Sept. 30, 2024, 9:46 a.m.