STK++ 0.9.13
|
Class for the multivariate Normal distribution. More...
#include <STK_MultiLaw_Normal.h>
Public Types | |
typedef MultiLaw::IMultiLaw< RowVector > | Base |
Public Member Functions | |
Normal (RowVector const &mu, ArraySquareX const &sigma) | |
Constructor. | |
virtual | ~Normal () |
destructor. | |
RowVector const & | mu () const |
@return the location parameter | |
ArraySquareX const & | sigma () const |
@return the variance-covariance matrix | |
ArraySquareX const & | squareroot () const |
@return the square root of the variance-covariance matrix | |
SymEigen< ArraySquareX > const & | decomp () const |
@return the eigenvalue decomposition | |
void | setParameters (RowVector const &mu, ArraySquareX const &sigma) |
update the parameters specific to the law. | |
virtual Real | pdf (RowVector const &x) const |
compute the probability distribution function (density) of the multivariate normal law | |
Real | lpdf (RowVector const &x) const |
compute the log probability distribution function. | |
template<class Array > | |
Real | lnLikelihood (Array const &data) const |
compute the log likehood of a data set. | |
virtual void | rand (RowVector &x) const |
simulate a realization of the Multivariate Law and store the result in x. | |
template<class Array > | |
void | rand (ArrayBase< Array > &x) const |
simulate a realization of the Multivariate Law and store the result in x (using a reference vector). | |
![]() | |
virtual | ~IMultiLaw () |
destructor. | |
![]() | |
String const & | name () const |
Protected Attributes | |
RowVector | mu_ |
The position parameter. | |
ArraySquareX | sigma_ |
The covariance parameter. | |
SymEigen< ArraySquareX > | decomp_ |
the decomposition in eigenvalues of the covariance matrix | |
ArrayDiagonalX | invEigenvalues_ |
inverse of the eigenvalues of sigma_ | |
ArraySquareX | squareroot_ |
The square root of the matrix Sigma_ . | |
![]() | |
String | name_ |
Name of the Law. | |
Additional Inherited Members | |
![]() | |
IMultiLaw (String const &name) | |
Constructor. | |
![]() | |
ILawBase (String const &name) | |
Constructor. | |
~ILawBase () | |
destructor. | |
Class for the multivariate Normal distribution.
In probability theory and statistics, the "multivariate normal distribution" or "multivariate Gaussian distribution", is a generalization of the one-dimensional (univariate) normal distribution to higher dimensions. A random vector is said to be multivariate normally distributed if every linear combination of its components has a univariate normal distribution. The multivariate normal distribution is often used to describe, at least approximately, any set of (possibly) correlated real-valued random variables each of which clusters around a mean value.
The multivariate normal distribution of a
can be written in the following notation
with
and
Definition at line 100 of file STK_MultiLaw_Normal.h.
typedef MultiLaw::IMultiLaw<RowVector> STK::MultiLaw::Normal< RowVector >::Base |
Definition at line 103 of file STK_MultiLaw_Normal.h.
|
inline |
Constructor.
Definition at line 108 of file STK_MultiLaw_Normal.h.
References STK::MultiLaw::Normal< RowVector >::mu(), STK::MultiLaw::Normal< RowVector >::setParameters(), and STK::MultiLaw::Normal< RowVector >::sigma().
|
inlinevirtual |
|
inline |
@return the eigenvalue decomposition
Definition at line 124 of file STK_MultiLaw_Normal.h.
References STK::MultiLaw::Normal< RowVector >::decomp_.
|
inline |
compute the log likehood of a data set.
sum the values of the log-pdf at the points stored in x.
data | the multivariate values to compute the lpdf. |
Definition at line 197 of file STK_MultiLaw_Normal.h.
References STK::MultiLaw::Normal< RowVector >::decomp_, STK::MultiLaw::Normal< RowVector >::invEigenvalues_, STK::MultiLaw::Normal< RowVector >::lnLikelihood(), STK::MultiLaw::Normal< RowVector >::mu_, STKRUNTIME_ERROR_NO_ARG, and STK::sum().
Referenced by STK::GaussianAAModel< Array >::computeProjectedLnLikelihood(), and STK::MultiLaw::Normal< RowVector >::lnLikelihood().
|
inlinevirtual |
compute the log probability distribution function.
Give the value of the log-pdf at the point x.
x | the multivariate value to compute the lpdf. |
Implements STK::MultiLaw::IMultiLaw< RowVector >.
Definition at line 179 of file STK_MultiLaw_Normal.h.
References STK::MultiLaw::Normal< RowVector >::decomp_, STK::MultiLaw::Normal< RowVector >::invEigenvalues_, STK::MultiLaw::Normal< RowVector >::lpdf(), STK::MultiLaw::Normal< RowVector >::mu_, and STKRUNTIME_ERROR_NO_ARG.
Referenced by STK::MultiLaw::Normal< RowVector >::lpdf(), and STK::MultiLaw::Normal< RowVector >::pdf().
|
inline |
@return the location parameter
Definition at line 118 of file STK_MultiLaw_Normal.h.
References STK::MultiLaw::Normal< RowVector >::mu_.
Referenced by STK::MultiLaw::Normal< RowVector >::Normal(), and STK::MultiLaw::Normal< RowVector >::setParameters().
|
inlinevirtual |
compute the probability distribution function (density) of the multivariate normal law
Give the value of the pdf at the point x.
x | the multivariate value to compute the pdf. |
Implements STK::MultiLaw::IMultiLaw< RowVector >.
Definition at line 162 of file STK_MultiLaw_Normal.h.
References STK::MultiLaw::Normal< RowVector >::decomp_, STK::MultiLaw::Normal< RowVector >::lpdf(), STK::MultiLaw::Normal< RowVector >::mu_, STK::MultiLaw::Normal< RowVector >::pdf(), STK::MultiLaw::Normal< RowVector >::sigma(), and STKRUNTIME_ERROR_NO_ARG.
Referenced by STK::MultiLaw::Normal< RowVector >::pdf().
|
inline |
simulate a realization of the Multivariate Law and store the result in x (using a reference vector).
The class RowVector have to derive from IContainerRef.
[out] | x | the simulated value. |
Definition at line 234 of file STK_MultiLaw_Normal.h.
References STK::MultiLaw::Normal< RowVector >::mu_, and STK::MultiLaw::Normal< RowVector >::squareroot_.
|
inlinevirtual |
simulate a realization of the Multivariate Law and store the result in x.
[out] | x | the simulated value. |
Implements STK::MultiLaw::IMultiLaw< RowVector >.
Definition at line 221 of file STK_MultiLaw_Normal.h.
References STK::MultiLaw::Normal< RowVector >::mu_, and STK::MultiLaw::Normal< RowVector >::squareroot_.
|
inline |
update the parameters specific to the law.
Definition at line 126 of file STK_MultiLaw_Normal.h.
References STK::MultiLaw::Normal< RowVector >::decomp_, STK::IRunnerBase::error(), STK::MultiLaw::Normal< RowVector >::invEigenvalues_, STK::MultiLaw::Normal< RowVector >::mu(), STK::MultiLaw::Normal< RowVector >::mu_, STK::IArray2D< Derived >::resize(), STK::IRegression< YArray, XArray, Weights >::run(), STK::IRunnerSupervised< YArray_, XArray_, Weights_ >::setData(), STK::MultiLaw::Normal< RowVector >::setParameters(), STK::MultiLaw::Normal< RowVector >::sigma(), STK::MultiLaw::Normal< RowVector >::sigma_, STK::MultiLaw::Normal< RowVector >::squareroot_, and STKRUNTIME_ERROR_NO_ARG.
Referenced by STK::MultiLaw::Normal< RowVector >::Normal(), and STK::MultiLaw::Normal< RowVector >::setParameters().
|
inline |
@return the variance-covariance matrix
Definition at line 120 of file STK_MultiLaw_Normal.h.
References STK::MultiLaw::Normal< RowVector >::sigma_.
Referenced by STK::MultiLaw::Normal< RowVector >::Normal(), STK::MultiLaw::Normal< RowVector >::pdf(), and STK::MultiLaw::Normal< RowVector >::setParameters().
|
inline |
@return the square root of the variance-covariance matrix
Definition at line 122 of file STK_MultiLaw_Normal.h.
References STK::MultiLaw::Normal< RowVector >::squareroot_.
|
protected |
the decomposition in eigenvalues of the covariance matrix
Definition at line 248 of file STK_MultiLaw_Normal.h.
Referenced by STK::MultiLaw::Normal< RowVector >::decomp(), STK::MultiLaw::Normal< RowVector >::lnLikelihood(), STK::MultiLaw::Normal< RowVector >::lpdf(), STK::MultiLaw::Normal< RowVector >::pdf(), and STK::MultiLaw::Normal< RowVector >::setParameters().
|
protected |
inverse of the eigenvalues of sigma_
Definition at line 250 of file STK_MultiLaw_Normal.h.
Referenced by STK::MultiLaw::Normal< RowVector >::lnLikelihood(), STK::MultiLaw::Normal< RowVector >::lpdf(), and STK::MultiLaw::Normal< RowVector >::setParameters().
|
protected |
The position parameter.
Definition at line 244 of file STK_MultiLaw_Normal.h.
Referenced by STK::MultiLaw::Normal< RowVector >::lnLikelihood(), STK::MultiLaw::Normal< RowVector >::lpdf(), STK::MultiLaw::Normal< RowVector >::mu(), STK::MultiLaw::Normal< RowVector >::pdf(), STK::MultiLaw::Normal< RowVector >::rand(), STK::MultiLaw::Normal< RowVector >::rand(), and STK::MultiLaw::Normal< RowVector >::setParameters().
|
protected |
The covariance parameter.
Definition at line 246 of file STK_MultiLaw_Normal.h.
Referenced by STK::MultiLaw::Normal< RowVector >::setParameters(), and STK::MultiLaw::Normal< RowVector >::sigma().
|
protected |
The square root of the matrix Sigma_
.
Definition at line 252 of file STK_MultiLaw_Normal.h.
Referenced by STK::MultiLaw::Normal< RowVector >::rand(), STK::MultiLaw::Normal< RowVector >::rand(), STK::MultiLaw::Normal< RowVector >::setParameters(), and STK::MultiLaw::Normal< RowVector >::squareroot().