leomartire / MVG-Moments

A Python/Matlab module to compute moments of multivariate Gaussian distributions, including non-trivial ones.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MVG-Moments

A Python/Matlab module to compute moments of multivariate Gaussian distributions, including non-trivial ones.

DOI

Problem Description

The considered distribution is the classical n-dimensional normalised multivariate Gaussian distribution:

  • \rho(x) := (2\pi)^{-n/2} * (det(\Sigma))^{-1/2} * \exp(- 0.5 * (x - \mu)^T * \Sigma^{-1} * (x - \mu)).

Usage

Let:

  • alpha_vals be the full matrix of orders of the wanted moments (assumed to be a matrix, size s * n where s is the number of moments up to a maximum degree d),
  • MU be the mean vector of rho,
  • SIGMA be the covariance matrix of rho.

Call:

CGMoms(alpha_vals, MU, SIGMA, verbose)

in order to compute the moments corresponding to the lines of alpha_vals of \rho.

Alternatively, call:

CGMoms_Kan(alpha, MU, SIGMA)

in order to compute only the moment of order alpha of \rho.

Example in Matlab

n = 2;
MU = [1; 2];
SIGMA = [3, 4; 5, 6];
alpha_vals = [0, 0;
              1, 0;
              0, 1;
              2, 0;
              1, 1;
              0, 2;
              3, 0;
              2, 1;
              1, 2;
              0, 3];
moments = CGMoms(alpha_vals, MU, SIGMA, verbose);

After the previous execution, moments is now a 10 * 1 matrix containing the moments of rho parametrised by MU and SIGMA.

Example in Python

See the file example.py.

References

  • Kan, R. (2008). From moments of sum to moments of product. Journal of Multivariate Analysis, 99(3):542 - 554.
  • Willink, R. (2005). Normal moments and hermite polynomials. Statistics & Probability Letters, 73(3):271 - 275.

About

A Python/Matlab module to compute moments of multivariate Gaussian distributions, including non-trivial ones.

License:GNU General Public License v3.0


Languages

Language:Python 51.5%Language:MATLAB 48.5%