
Linear Gaussian state-space model: Kalman filter and smoother
Source:R/StateSpaceKalman.R
Stsmod.RdR arm of morie.fn.stsmod: \(y_t = Z a_t + e_t\), \(e_t \sim
N(0, H)\); \(a_{t+1} = T a_t + R n_t\), \(n_t \sim N(0, Q)\),
\(a_1 \sim N(a1, P1)\) (default 0 and \(10^6 I\)). Kalman filter with
the prediction-error decomposition of the log-likelihood, filtered states
and the Durbin-Koopman backward smoother.
References
Durbin, J. and Koopman, S. J. (2012). Time Series Analysis by State Space Methods, 2nd ed. Oxford University Press.
Examples
Stsmod(c(1.1, 0.9, 1.4, 1.2, 1.6), 1, 1, 0.5, 0.2, 1, a1 = 0, P1 = 10)$loglik
#> [1] -6.039096