qnwunif: Gaussian quadrature nodes and weights for uniform...

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

View source: R/qnwunif.R

Description

Generates Gaussian quadrature nodes and probability weights for multivariate Uniform distribution on hypercube [a,b] in R^d.

Usage

1
qnwunif(n, a = matrix(0, 1, length(n)), b = matrix(1, 1, length(n)))

Arguments

n

1.d number of nodes per dimension

a

1.d left endpoints

b

1.d right endpoints

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; qnwnorm; qnwsimp; qnwtrap; quadrature

Examples

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

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

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