Numerically integrate a multivariate polynomial

Description

Integrates a multivariate polynomial against a specified non-central multivariate distribution using ordinary integration by invoking the adaptIntegrate function from the cubature package.

Usage

1
integrate.polynomial(poly,mu,sigma,lower=NULL,upper=NULL) 

Arguments

poly

either an object of class 'mpoly' or 'multipol', or a list with two components for coefficients and powers.

mu

a vector giving the mean of the multivariate distribution

sigma

a square matrix giving the covariance matrix of the multivariate distribution

lower

vectors of the lower limits of integration, one element for each dimension of the moment

upper

vectors of the upper limits of integration, one element for each dimension of the moment

Details

Defaults for lower and upper are -/+ 6 times the standard deviations (square roots of diagonal elements of the covariance matrix). If the polynomial is defined by a list, it has two components, coeff and powers. powers is a matrix. Each row represents the powers for a term in the polynomial. coeff is a vector. Each element is the coefficient of the corresponding power. Example corresponding to example below: list(coeff=c(3,2,-4,1),powers=matrix(c(2,0,0,1,3,0,0,0,2,1,2,1),ncol=3,byrow=TRUE))

Value

the expected value of the polynomial integrated against the multivariate normal distribution

Author(s)

Kem Phillips <kemphillips@comcast.net>

References

K Phillips, Symbolic Computation of the Central Moments of the Multivariate Normal Distribution, Journal of Statistical Software, 2010.

See Also

evaluate.expected.polynomial, multmoments, evaluate, and simulate in symmoments

Examples

1
2
3
4
5
6
7
# define a mpoly object for a multivariate polynomial, and 
# determine its expected value at specified mean and covariance matrix:

# t0 <- mpoly(list(c(coef=3,x1=2),c(coef=2,x1=1,x2=3),c(coef=-4,z=2),c(coef=1,x1=1,x2=2,z=1)))


# integrate.polynomial(t0,c(1,2,3),matrix(c(1,0,0,0,1,0,0,0,1),nrow=3,byrow=TRUE))