gauss.hermite(f, mu = 0, sd = 1, ..., order = 5)f.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 Rlanguage
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.
gauss.hermite(function(x) x^2, 3, 1)Run the code above in your browser using DataLab