Learn R Programming

FactorCopulaModel (version 0.1.1)

gaussLegendre: R interface for Gauss-Legendre quadrature

Description

Gauss-Legendre quadrature nodes and weights

Usage

gaussLegendre(nq)

Value

structures with

Arguments

nq

number of quadrature points

Details

links to C code translation of jacobi.f in Stroud and Secrest (1966)

Examples

Run this code
out = gaussLegendre(15)
# same as statmod::gauss.quad.prob(15,dist="uniform") in library(statmod)
print(sum(out$weights)) # should be 1
print(sum(out$weights*out$nodes)) # should be 0.5  = E(U), U~Uniform(0,1)
print(sum(out$weights*out$nodes^2)) # should be 1/3 = E(U^2)

Run the code above in your browser using DataLab