TMB Documentation  v1.9.10
Public Member Functions | List of all members
density::AR1_t< distribution > Class Template Reference

Stationary AR1 process. More...

#include <density.hpp>

Public Member Functions

scalartype operator() (vectortype x)
 Evaluate the negative log density.
 
void simulate (vectortype &x)
 Draw a simulation from the process.
 

Detailed Description

template<class distribution>
class density::AR1_t< distribution >

Stationary AR1 process.

Class to evaluate the negative log density of a (multivariate) AR1 process with parameter phi and given marginal distribution.

Parameters
phiScalar -1<phi<1
Template Parameters
MARGINALThe desired (multivariate) marginal distribution.

Let \(f(x)\) denote a multivariate Gaussian mean-zero negative log density represented by its covariance matrix \(\Sigma\). Define recursively the vectors

\[x_0\sim N(0,\Sigma)\]

\[x_1 = \phi x_0 + \sigma\varepsilon_1\:,\:\:\: \varepsilon_1 \sim N(0,\Sigma)\]

\[x_i = \phi x_{i-1} + \sigma\varepsilon_i\:,\:\:\: \varepsilon_i \sim N(0,\Sigma)\]

where \(\sigma=\sqrt{1-\phi^2}\). Then \(E(x_i)=0\), \(V(x_i)=\Sigma\) and the covariance is \(E(x_ix_j')=\phi^{|i-j|}\Sigma\). We refer to this process as a stationary 1st order autoregressive process with multivariate increments with parameter phi and marginal distribution f. Compactly denoted AR1(phi,f).

Note that the construction can be carried out recursively, as "AR1(phi,f)" is itself a distribution that can be used as input to AR1(). See example below:

\\ Construct negative log density of standard AR1 process on a line:
Type phi1=0.8;
AR1_t<N01<Type> > f1(phi1);
\\ Can be evaluated on a vector:
Type ans=f1(x);

Now use f1 as marginal in a new AR1 process with parameter phi2:

\\ Construct negative log density of standard AR1 process on a line:
Type phi2=0.5;
AR1_t<AR1_t<N01<Type> > > f2(phi1,f1);
\\ Can be evaluated on a 2-dimensional array:
vector<Type> x(10,20);
Type ans=f2(x);
Examples:
multivariate_distributions.cpp.

Definition at line 375 of file density.hpp.


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