kfilter {sspir} | R Documentation |
From an SS object, runs the Kalman filter to produce the conditional means and variances of the state vectors given the current time point.
kfilter(ss)
ss |
object of class SS . |
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.
An object of class SS
with the components m
,
C
, and loglik
updated.
Claus Dethlefsen and Søren Lundbye-Christensen.
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)