kfMFPD: Kalman marginal (forward) filtering computation and...

View source: R/02_kf_MF.R

kfMFPDR Documentation

Kalman marginal (forward) filtering computation and prediction

Description

Runs (Marginal) filtering and prediction recursions, as described in the corresponding "(Marginal) Filtering and prediction - implemented recursions" subsection of the Details section in kfLGSSM.

Usage

kfMFPD(
  yObs,
  uReg,
  wReg,
  dimX,
  dimY,
  TT,
  x00,
  P00,
  u00,
  A,
  B,
  C,
  D,
  Q,
  R,
  PDSTORE = FALSE
)

Arguments

yObs

A matrix or vector of measurements (observations):

  • rows: multivariate dimension

  • columns: time series dimension T

If Y is a univariate process, yObs can be passed as a vector of length T. If nrow(yObs) = 1, then yObs becomes a vector of length T.

uReg

Matrix (vector) of regressors for the latent state process of dimension ncol(B) x T. For a single regressors uReg is a vector of length T.

wReg

Matrix (vector) of regressors for the measurement process of dimension ncol(D) x T. For a single regressors wReg is a vector of length T.

dimX

integer giving the dimension of the latent state process

dimY

integer giving the dimension of the measurement process

TT

integer giving the length of the time series

x00

see initX from kfLGSSM

P00

see initP from kfLGSSM

u00

see initU from kfLGSSM

A

Parameter (or system) matrix of dimension dimX x dimX.

B

Parameter (or system) matrix of dimension dimX x numU.

C

Parameter (or system) matrix of dimension dimY x dimX.

D

Parameter (or system) matrix of dimension dimY x numW.

Q

Error VCM of state process of dimension dimX x dimX.

R

Error VCM of measurement process of dimension dimY x dimY

PDSTORE

logical; if TRUE prediction quantities \hat{P}_{t|t-1} and \hat{x}_{t|t-1} are stored \forall t=1,\ldots,T; otherwise, only stored for current iteration t and not returned.

Value

if PDSTORE = FALSE a named list of two

  • mfdEXP a matrix of dimension dimX x TT with each column being the corresponding \hat{x}_{t|t} (see the Details section in kfLGSSM).

  • mfdVAR an array of dimension dimX x dimX x TT with matrices \hat{P}_{t|t} of dimension dimX x dimX \forall t = 1,\ldots,TT (see the Details section in kfLGSSM).

if PDSTORE = TRUE a named list of four:

  • mfdEXP as above

  • mfdVAR as above

  • pddEXP a matrix of dimension dimX x (TT + 1) with each column being the corresponding \hat{x}_{t+1|t}, starting from \hat{x}_{1|0} and running to \hat{x}_{T+1|T} (see the Details section in kfLGSSM).

  • pddVAR an array of dimension dimX x dimX x (TT + 1) with matrices \hat{P}_{t+1|t} of dimension dimX x dimX, \forall t = 1, \ldots,TT + 1, starting with \hat{P}_{1|0} and running to \hat{P}_{T+1|T} (see the Details section in kfLGSSM).


ilyaZar/RcppSMCkalman documentation built on Oct. 19, 2023, 11 a.m.