Description Usage Arguments Details Value Author(s) References See Also Examples
Integrates a multivariate polynomial against a specified non-central multivariate distribution using ordinary integration by invoking the adaptIntegrate function from the cubature package.
1 | integrate.polynomial(poly,mu,sigma,lower=NULL,upper=NULL)
|
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 |
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))
the expected value of the polynomial integrated against the multivariate normal distribution
Kem Phillips <kemphillips@comcast.net>
K Phillips, Symbolic Computation of the Central Moments of the Multivariate Normal Distribution, Journal of Statistical Software, 2010.
evaluate.expected.polynomial, multmoments, evaluate, and simulate in symmoments
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))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.