# NAME

Math::Vector::Real::MultiNormalMixture - Multinormal Mixture distribution

# SYNOPSIS

``````  use Math::Vector::Real::MultiNormalMixture;

my \$mnm = Math::Vector::Real::MultiNormalMixture->new(
mu    => [[0.0, 0.0], [1.0, 0.0], [0.0, 1.5]],
sigma => [ 1.0,        1.0,        2.0      ],
alpha => [ 0.5,        0.25,       0.25     ]
);

my \$d = \$mnm->density([0.5, 0.2]);``````

# DESCRIPTION

This module allows to calculate the density of a mixture of n multivariate normal simetric distributions.

Given a multivariate normal simetric distributions in IR**k (IR := the real numbers domain) such that its density function can be calculated as...

``````  p(\$x) = (sqrt(2*pi)*\$sigma)**(-\$k) * exp(|\$x-\$mu|/\$sigma)**2)

where

\$x is a vector of dimension k,
\$mu is the median vector of the distribution,
\$d = |\$x - \$mu|, the distance between the median and x
\$sigma is the standard deviation,
(the covariance matrix is restricted to \$sigma*\$Ik being \$Ik
the identity matrix of size k)``````

A multivariate normal distribution mixin is defined as a weighted mix of a set of multivariate normal simetric distributions, such that its density function is...

``  pm(x) = sum ( \$alpha[\$i] * p[\$i](x) )``

## API

The following methods are available:

\$mnm = Math::Vector::Real::MultiNormalMixture->new(%opts)

Creates a new Multivariate Normal Mixture distribution object.

The accepted arguments are as follow:

mu => \@mu

An array of vectors (or array references) containing the mediams of the single multinormal distributions.

alpha => \@alpha

An array of coeficients with the mixing weights. This argument is optional.

sigma => \@sigma

An array with the sigma parameter for every one of the multinormal distributions.

A single value can also be provided and all the multinormal distributions will have it.

The default sigma value is 1.0.

\$mnm->density(\$x)

Returns the distribution density at the given point.

\$mnm->density_portion(\$x, \$i0, \$i1, \$i2, ...)

Returns the density portion associated to the multivariate normals with indexes `\$i0`, `\$i1`, etc.

Returns density and the gradient of the density function at the given point.

\$d = \$mnm->max_density_estimation

Returns the maximun value of the density in IR**k.

Mixture distribution on the wikipedia: http://en.wikipedia.org/wiki/Mixture_model

Multivariate normal distribution on the wikipedia: http://en.wikipedia.org/wiki/Multivariate_normal_distribution.

Math::Vector::Real