TMB Documentation  v1.9.11
density::GMRF_t< scalartype_ > Class Template Reference

Gaussian Markov Random Field. More...

#include <density.hpp>

## Detailed Description

### template<class scalartype_> class density::GMRF_t< scalartype_ >

Gaussian Markov Random Field.

 Class to evaluate the negative log density of a mean zero multivariate
normal distribution with a sparse precision matrix. Let Q denote the
precision matrix. Then the density is proportional to
|Q|^.5*exp(-.5*x'*Q*x)

Three constructors are available:

1. General case
===============
The user supplies the precision matrix Q of class Eigen::SparseMatrix<Type>

2. Special case: GMRF on d-dimensional lattice.
===============================================
The user supplies a d-dim lattice for which Q is automatically
constructed like this:
First order Gaussian Markov Random Field on (subset of) d-dim grid.
Grid is specified through the first array argument to constructor,
with individual nodes determined by the outdermost dimension
e.g. x= 1 1 2 2
1 2 1 2
corresponding to a 2x2 lattice with 4 nodes and d=2.

Example of precision in 2D:

-1
-1 4+c -1
-1

The precision Q is convolved with it self "order" times. This way
more smoothness can be obtained. The quadratic form contribution
is .5*x'*Q^order*x

3. Vector of deltas
===================
The parameter "delta" describes the (inverse) correlation. It is
allowed to specify a vector of deltas so that different spatial
regions can have different spatial correlation.

NOTE: The variance in the model depends on delta. In other words:
The model may be thought of as an arbitrary scaled correlation
model and is thus not really meaningful without an additional scale
parameter (see SCALE_t and VECSCALE_t classes).


Definition at line 828 of file density.hpp.

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