GHQ: Gaussian Hermite Quadrature with prunning

Description Usage Arguments Value Author(s) References Examples

View source: R/GHQ.r

Description

This function is used to obtain quadrature points to approximate an integral

Usage

1
GHQ(n, ndim, pruning = TRUE)

Arguments

n

number of quadrature points

ndim

number of integrals or dimension problem

pruning

a logical indicating whether you want pruning approach, by default is TRUE

Value

nodes

nodes

weights

weights

product

product weights

Author(s)

Freddy Hernandez Barajas

References

Hernandez, F., Usuga, O. and Giampaoli, V. (2014). Improving the Adaptive Gaussian Quadrature. Journal of Statistical Software, submitting.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# Comparing the number of points in a two-dimensional case
require(GHQp)
par(mfrow=c(2,2))
plot(GHQ(15,2,FALSE)$nodes,pch=20,xlab='',ylab='',
     main='Without pruning, n=15 and q=2')
plot(GHQ(15,2,TRUE)$nodes, pch=20,xlab='',ylab='',
     main='With pruning, n=15 and q=2')

# Comparing the number of points in a three-dimensional case
require(scatterplot3d)
datos <- GHQ(15,3,FALSE)$nodes
scatterplot3d(datos, type="p", highlight.3d=TRUE,
              angle=55, scale.y=0.7, pch=16,
              main='Without pruning, n=15 and q=3', 
              cex.symbols=0.4,xlab='',ylab='',zlab='')
datos <- GHQ(15,3,TRUE)$nodes
scatterplot3d(datos, type="p", highlight.3d=TRUE,
              angle=55, scale.y=0.7, pch=16,
              main='With pruning, n=15 and q=3', 
              cex.symbols=0.4,xlab='',ylab='',zlab='')

Example output

Loading required package: statmod
Loading required package: scatterplot3d

GHQp documentation built on May 2, 2019, 3:39 p.m.