Math::Vector::Real::MultiNormalMixture - Multinormal Mixture distribution
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]);
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) )
The following methods are available:
Creates a new Multivariate Normal Mixture distribution object.
The accepted arguments are as follow:
An array of vectors (or array references) containing the mediams of the single multinormal distributions.
An array of coeficients with the mixing weights. This argument is optional.
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.
Returns the distribution density at the given point.
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.
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.
Salvador Fandiño, <sfandino@yahoo.com>
Copyright (C) 2011 by Salvador Fandino
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.12.3 or, at your option, any later version of Perl 5 you may have available.