llt: Kalman filtering and smoothing for local linear trend plus...

View source: R/RcppExports.R

lltR Documentation

Kalman filtering and smoothing for local linear trend plus noise

Description

It uses the power of C++, scalar computation and pointers to run the Kalman filter, the smoother and compute the log-likelihood. The R user has to supply many vectors that in most cases will be overwritten by the llt() function since they are passed by reference. All passed parameters must be numerical (floating point) vectors: any other kind of variable may cause serious problems to the stability of your system. Passing vectors of integers will make the computations fail.

Usage

llt(
  y,
  var_eps,
  var_eta,
  var_zeta,
  cov_eta_zeta,
  a1,
  a2,
  p11,
  p12,
  p22,
  k1,
  k2,
  i,
  f,
  r1,
  r2,
  n11,
  n12,
  n22,
  e,
  d,
  w_ = NULL
)

Arguments

y

vector of n observations

var_eps

vector of n variances for the observation noises

var_eta

vector of n variances for the level disturbances

var_zeta

vector of n variances for the slope disturbances

cov_eta_zeta

vector of n covariances between level and slope disturbances

a1

vector of n+1 one-step-ahead prediction of the level; the first element is the initial condition for the level at time t=1, the other elements are arbitrary and will be overwritten

a2

vector of n+1 one-step-ahead prediction of the slope; the first element is the initial condition for the slope at time t=1, the other elements are arbitrary and will be overwritten

p11

vector of n+1 one-step-ahead prediction error variance of the level; the first element is the initial condition for the level at time t=1, the other elements are arbitrary and will be overwritten

p12

vector of n+1 one-step-ahead prediction covariances for level and slope; the first element is the initial condition for the slope at time t=1, the other elements are arbitrary and will be overwritten

p22

vector of n+1 one-step-ahead prediction error variance of the slope; the first element is the initial condition for the level at time t=1, the other elements are arbitrary and will be overwritten

k1

vector of the n Kalman gains for the level equation; values are arbitrary and will be overwritten;

k2

vector of the n Kalman gains for the slope equation; values are arbitrary and will be overwritten;

i

vector of the n innovations; values are arbitrary and will be overwritten;

f

vector of the n innovatoin variances;values are arbitrary and will be overwritten;

r1

vector of the n+1 smoothers (Th.5.4 in Pelagatti, 2015) for the level equation; values are arbitrary and will be overwritten;

r2

vector of the n+1 smoothers (Th.5.4 in Pelagatti, 2015) for the slope equation; values are arbitrary and will be overwritten;

n11

vector of the n+1 variance smoothers (Th.5.4 in Pelagatti, 2015) for the level equation; values are arbitrary and will be overwritten;

n12

vector of the n+1 covariance smoothers (Th.5.4 in Pelagatti, 2015) for the level and slope; values are arbitrary and will be overwritten;

n22

vector of the n+1 variance smoothers (Th.5.4 in Pelagatti, 2015) for the slope equation; values are arbitrary and will be overwritten;

e

vector of the n+1 observation error smoothers (Th.5.4 in Pelagatti, 2015); values are arbitrary and will be overwritten;

d

vector of the n+1 observation error variance smoothers (Th.5.4 in Pelagatti, 2015); values are arbitrary and will be overwritten;

w_

NULL (default) or vector of n weights for the effect of observation y_t on the estimation of the hp filter (with jumps) at time t; values are arbitrary and will be overwritten;

Value

The value of the Gaussian log-likelihood net of the -log(2*pi)*n/2 part that can be added if needed.


jumps documentation built on April 4, 2025, 2:22 a.m.