Learn R Programming

spate (version 1.7.5)

ffbs: Forward Filtering Backward Sampling algorithm.

Description

Forward Filtering Backward Sampling algorithm for sampling from the joint full conditional of the hidden state of a linear, Gaussian state space model. To be more specific, one samples from \(P[\alpha|.]\) where \(\alpha\) is specified through $$y_t = lp_t + H xi_t + nu_t, \nu_t ~ N(0,\Omega)$$ and $$\alpha_t = G \alpha_{t-1} + \epsilon_t, \epsilon_t ~ N(0,\Sigma).$$

Usage

ffbs(y, lp, G, Sigma, H, Omega, N = dim(y)[2],T = dim(y)[1],
      NF = dim(G)[1], lglk = FALSE, BwSp = TRUE, filt = FALSE)

Value

A list with entries (depending on whether 'lglk', 'BwSp', 'filt' are 'TRUE' or 'FALSE'):

simAlpha

A T x N matrix with a sample from the full conditional of latent process \(\alpha\),

ll

The evaluated log-likelihood,

mtt

A T x N matrix with the mean of the full conditional of latent process \(\alpha\).

Arguments

y

Observed data in an T x N matrix with columns and rows corresponding to time and space, respectively.

lp

Mean (linear predictor) in an T x N matrix with columns and rows corresponding to time and space, respectively.

G

Propagator matrix of the latent process \(\alpha\).

Sigma

Innovation covariance matrix of the latent process \(\alpha\).

H

Observation matrix relating y to \(\alpha\).

Omega

Covariance matrix of the observation error \(\nu\).

N

Number of points in space.

T

Number of points in time.

NF

Dimension of the latent process \(\alpha\).

lglk

Logical; if 'TRUE' the value of the log-likelihood is returned as well.

BwSp

Logical; if 'TRUE' a sample from the full conditional of \(\alpha\) is returned.

filt

Logical; if 'TRUE' the filtered values for \(\alpha\) are returned.

Author

Fabio Sigrist

Details

In the context of the SPDE, \(\alpha\) are the Fourier coefficients.