qnwnorm: Gaussian quadrature nodes and weights for normal distribution

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/qnwnorm.R

Description

Generates Gaussian quadrature nodes and probability weights for multivariate normal distribution with mean vector mu and variance matrix var

Usage

1
qnwnorm(n, mu = matrix(0, 1, length(n)), var = diag(length(n)))

Arguments

n

1.d number of nodes per dimension

mu

1.d mean vector (default: zeros)

var

d.d positive definite variance matrix (default: identity matrix)

Value

List with fields

Author(s)

Randall Romero-Aguilar, based on Miranda & Fackler's CompEcon toolbox

References

Miranda, Fackler 2002 Applied Computational Economics and Finance

See Also

Other quadrature functions: qnwequi; qnwlege; qnwlogn; qnwsimp; qnwtrap; qnwunif; quadrature

Examples

1
2
3
4
5
6
7
# To compute Ef(X) when f is real-valued and X is Normal(mu,var) on R^d,
# write a function f that returns m.1 vector when passed an m.d matrix, and write
q  <- qnwnorm(n,mu,var)
Ef  <- crossprod(q$w, f(q$x))

# Alternatively, use the quadrature function
Ef <- quadrature(f,qnwnorm,n,mu,var)

randall-romero/CompEconR documentation built on May 26, 2019, 10:56 p.m.