TMB Documentation  v1.9.11
List of all members
density::UNSTRUCTURED_CORR_t< scalartype_ > Class Template Reference

Multivariate normal distribution with unstructered correlation matrix. More...

#include <density.hpp>

Additional Inherited Members

- Public Member Functions inherited from density::MVNORM_t< scalartype_ >
matrixtype cov ()
 Covariance matrix extractor. More...
scalartype operator() (vectortype x)
 Evaluate the negative log density.
scalartype operator() (vectortype x, vectortype keep)
 Evaluate projected negative log density. More...

Detailed Description

template<class scalartype_>
class density::UNSTRUCTURED_CORR_t< scalartype_ >

Multivariate normal distribution with unstructered correlation matrix.

Class to evaluate the negative log density of a multivariate Gaussian variable with unstructured symmetric positive definite correlation matrix (Sigma). The typical application of this is that you want to estimate all the elements of Sigma, in such a way that the symmetry and positive definiteness constraint is respected. We parameterize S via a lower triangular matrix L with unit diagonal i.e. we need (n*n-n)/2 parameters to describe an n dimensional correlation matrix.

For instance in the case n=4 the correlation matrix is given by

\[\Sigma = D^{-\frac{1}{2}}LL'D^{-\frac{1}{2}}\]


\[ L=\begin{pmatrix} 1 \\ \theta_0 & 1 \\ \theta_1 & \theta_2 & 1 \\ \theta_3 & \theta_4 & \theta_5 & 1 \end{pmatrix} \]

(lower triangle filled row-wise) and

\[ D=diag(LL') \]


// Construct density object of dimension 4
vector<Type> theta(6);
UNSTRUCTURED_CORR_t<Type> nll(theta);
res = nll(x); // Evaluate neg. log density
Sigma is available via MVNORM_t::cov , e.g.
Sigma has 1's on its diagonal. To scale the variances we can use VECSCALE_t , e.g.
vector<Type> sds(4);
sds.fill(2.0); // Set all standard deviations to 2.0
res = VECSCALE_t(nll,sds)(x);
multivariate_distributions.cpp, and sdv_multi_compact.cpp.

Definition at line 260 of file density.hpp.

The documentation for this class was generated from the following file:
License: GPL v2