integrate.polynomial: Numerically Integrate a Multivariate Polynomial

integrate.polynomialR Documentation

Numerically Integrate a Multivariate Polynomial

Description

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

Usage

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

Arguments

poly

An object of class 'mpoly' or 'multipol', or a simple list containing two components (coeff and powers) defining the polynomial.

mu

A numeric vector giving the mean vector \mu of the multivariate normal distribution.

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 NULL (the default), it defaults to -6 times the standard deviations from the mean.

upper

A numeric vector of the upper limits of integration, containing one element for each dimension. If NULL (the default), it defaults to +6 times the standard deviations from the mean.

Details

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))

Value

The expected value of the polynomial numerically integrated against the specified multivariate normal distribution.

Author(s)

Kem Phillips kemphillips@comcast.net

References

\insertRef

Phillips2010symmoments

See Also

evaluate_expected.polynomial, multmoments, evaluate, simulate

Examples

## 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)


symmoments documentation built on May 27, 2026, 9:06 a.m.