Description Usage Arguments Details Value References See Also Examples
createNIGrid
Creates a grid for multivariate numerical integration.
The Grid can be based on different quadrature and constructionrules.
1 2 
dim 
number of dimensions 
type 
quadrature rule (see Details) 
level 
accuracy level (typically number of grid points for the underlying 1D quadrature rule) 
ndConstruction 
character vector which denotes the construction rule for multidimensional grids.

level.trans 
logical variable denotes either to take the levels as number
of grid points (FALSE = default) or to transform in that manner that number of
grid points = 2^(levels1) (TRUE). Alternatively 
The following quadrature rules are supported (buildin).
cNC1, cNC2, ..., cNC6
closed NewtonCotes Formula of degree 16 (1=trapezoidalrule; 2=Simpson'srule; ...), initial interval of integration: [0, 1]
oNC0, oNC1, ..., oNC3
open NewtonCote Formula of degree 03 (0=midpointrule; ...), initial interval of integration: [0, 1]
GLe, GKr
GaussLegendre and GaussKronrod rule for an initial interval of integration: [0, 1]
nLe
nested GaussLegendre rule for an initial interval of integration: [0, 1] (Knut Petras (2003). Smolyak cubature of given polynomial degree with few nodes for increasing dimension. Numerische Mathematik 93, 729753)
GLa
GaussLaguerre rule for an initial interval of integration: [0, INF)
GHe
GaussHermite rule for an initial interval of integration: (INF, INF)
nHe
nested GaussHermite rule for an initial interval of integration: (INF, INF) (A. Genz and B. D. Keister (1996). Fully symmetric interpolatory rules for multiple integrals over infinite regions with Gaussian weight." Journal of Computational and Applied Mathematics 71, 299309)
GHN
, nHN
(nested) GaussHermite rule as before but weights are multiplied by the standard normal density (\hat(w)_i = w_i * φ(x_i)).
Leja
LejaPoints for an initial interval of integration: [0, 1]
The argument type
and level
can also be vectorvalue, different for each dimension (the later only for "product rule"; see examples)
Returns an object of class 'NIGrid'. This object is basically an environment
containing nodes and weights and a list of features for this special grid. This
grid can be used for numerical integration (via quadrature
)
Philip J. Davis, Philip Rabinowitz (1984): Methods of Numerical Integration
F. Heiss, V. Winschel (2008): Likelihood approximation by numerical integration on sparse grids, Journal of Econometrics
H.J. Bungartz, M. Griebel (2004): Sparse grids, Acta Numerica
rescale
, quadrature
, print
, plot
and size
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21  ## 1DGrid > closed NewtonCotes Formula of degree 1 (trapeziodalrule)
myGrid < createNIGrid(dim=1, type="cNC1", level=10)
print(myGrid)
## 2DGrid > nested GaussLegendre rule
myGrid < createNIGrid(dim=2, type=c("GLe","nLe"), level=c(4, 7))
rescale(myGrid, domain = rbind(c(1,1),c(1,1)))
plot(myGrid)
print(myGrid)
myFun < function(x){
1x[,1]^2*x[,2]^2
}
quadrature(f = myFun, grid = myGrid)
## level transformation
levelTrans < function(x){
tmp < as.matrix(x)
tmp[, 2] < 2*tmp[ ,2]
return(tmp)
}
nw < createNIGrid(dim=2, type="cNC1", level = 3,
level.trans = levelTrans, ndConstruction = "sparse")
plot(nw)

Warning messages:
1: In weights * interv_length :
Recycling array of length 1 in vectorarray arithmetic is deprecated.
Use c() or as.vector() instead.
2: In (0L:n) * by :
Recycling array of length 1 in vectorarray arithmetic is deprecated.
Use c() or as.vector() instead.
Grid for Numerical Integration
# dimensions: 1 # gridpoints: 11 used memory:656 bytes
same quadrature rule for each dimension
type: cNC1
level: 10
initial domain: 0 1
Grid for Numerical Integration
# dimensions: 2 # gridpoints: 60 used memory:1.8 Kb
nDConstruction principle: 'product'
individual quadrature rule for each dimension
dim = 1 > type: GLe level: 4 initial domain: 0 1
dim = 2 > type: nLe level: 7 initial domain: 0 1
Grid rescaled. New Domain:
a b
dim 1: 1 1
dim 2: 1 1
[1] 3.555556
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.