State space and the Kalman filter¶
In the app: Help → Help contents, State space and the Kalman filter.
A state-space model links observed series to unobserved states, such as potential output, the trend, the cycle or the neutral rate, that evolve with shocks. The Kalman filter estimates the states period by period from the data up to then (filtered, real-time estimates); the smoother uses all the data (smoothed, two-sided estimates). The likelihood from the filter gives maximum-likelihood estimates of the parameters, or the posterior mode when parameters have priors. Unit-root states such as trends start diffuse (unknown); stationary states such as cycles and gaps start from their stationary distribution. The HP filter is the smoothed trend of a smooth-trend model with signal-to-noise ratio 1/lambda.
With diffuse states the log likelihood is the exact diffuse likelihood (Durbin and Koopman 2012, section 7.2.2): the first d periods, until the diffuse states are pinned down, each add -(log 2 pi + log F_inf)/2 per observation, the later ones the usual -(log 2 pi + log F + v^2/F)/2. statsmodels' UnobservedComponents and SARIMAX report by default the likelihood of the later periods given the first d (Harvey 1989), higher by d/2 log 2 pi + 1/2 sum log F_inf: 7.367 for a local linear trend with a quarterly seasonal (d = 5). Diffuse periods in the likelihood (Advanced; diffuse_terms="exclude" in code) reports that convention. Estimates and standard errors do not change, only the level of the log likelihood, AIC, BIC and HQ. Compare criteria across models only in one convention and with the same diffuse states; never compare one package's level with another's without checking which terms each counts.
See also¶
References¶
- Durbin, J. and Koopman, S. J. (2012). Time Series Analysis by State Space Methods, 2nd ed. doi:10.1093/acprof:oso/9780199641178.001.0001
- Harvey, A. C. (1989). Forecasting, Structural Time Series Models and the Kalman Filter. doi:10.1017/cbo9781107049994
- Hamilton, J. D. (1994). Time Series Analysis, chapter 13, "The Kalman filter". Princeton University Press. doi:10.2307/j.ctv14jx6sm