| integrate.polynomial | R Documentation |
Integrates a multivariate polynomial against a specified non-central
multivariate normal distribution using ordinary numerical integration via
the adaptIntegrate function from the cubature package.
integrate.polynomial(poly, mu, sigma, lower = NULL, upper = NULL)
poly |
An object of class |
mu |
A numeric vector giving the mean vector |
sigma |
A square matrix specifying the covariance matrix of the multivariate normal distribution. |
lower |
A numeric vector of the lower limits of integration, containing
one element for each dimension. If |
upper |
A numeric vector of the upper limits of integration, containing
one element for each dimension. If |
Defaults for lower and upper boundaries are set to
\pm 6 times the standard deviations (the square roots of the diagonal
elements of the covariance matrix sigma).
If the polynomial is defined by a simple list, it must contain two components:
powers: A matrix where each row represents the exponents/powers
for a single term in the polynomial.
coeff: A numeric vector where each element is the coefficient
of the corresponding row in powers.
For example, the list structure equivalent to the polynomial in the examples section is:
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 numerically integrated against the specified multivariate normal distribution.
Kem Phillips kemphillips@comcast.net
Phillips2010symmoments
evaluate_expected.polynomial, multmoments,
evaluate, simulate
## Not run:
library(mpoly)
# Define an mpoly object for a multivariate polynomial
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)
))
# Numerically integrate against a specified mean and covariance identity matrix
integrate.polynomial(t0, c(1, 2, 3), matrix(c(1,0,0, 0,1,0, 0,0,1), nrow = 3, byrow = TRUE))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.