kfilter {sspir}R Documentation

Kalman filter for Gaussian state space model

Description

From an SS object, runs the Kalman filter to produce the conditional means and variances of the state vectors given the current time point.

Usage

kfilter(ss)

Arguments

ss object of class SS.

Details

The Kalman filter yields the distribution

(theta_t|y[,1:t]) ~ N(m_t, C_t)

through the recursion for t=1,...,n,

a_t = G_t m_{t-1}

R_t = G_t C_{t-1} G_t^T + W_t

f_t = F_t^T a_t

Q_t = F_t^T R_t F_t + V_t

e_t = y_t - f_t

A_t = R_t F_t Q_t^{-1}

m_t = a_t + A_t e_t

C_t = R_t - A_t Q_t A_t^T

Also, the log-likelihood is calculated.

Value

An object of class SS with the components m, C, and loglik updated.

Author(s)

Claus Dethlefsen and Søren Lundbye-Christensen.

See Also

SS, smoother

Examples

data(kurit)
m1 <- SS(kurit)
phi(m1) <- c(100,5)
m0(m1) <- matrix(130)
C0(m1) <- matrix(400)

m1.f <- kfilter(m1)
plot(m1$y)
lines(m1.f$m,lty=2)

[Package sspir version 0.2.3 Index]