- Introduced by
- Rudolf E. Kalman; systematised for time series by Andrew Harvey and Søren Johansen
- Year
- 1960; time series state-space framework formalised 1980s–1990s
- Type
- recursive Bayesian filter / state-space smoother
- Family
- Bayesian / computational
What does it do?
The time series Kalman filter applies the Kalman filtering and smoothing algorithm to a state-space representation of a time series model.
It recursively estimates unobserved components such as trend, seasonality, cycles and irregular noise, and gives filtered and smoothed state estimates with their uncertainty. Under the model's linear-Gaussian assumptions, the same recursions also yield the exact likelihood used to estimate unknown parameters.
The intuition behind the method
Think of the series as the noisy output of a hidden system whose internal state changes over time. The state equation describes how that state evolves, and the observation equation describes how the data are generated from it. The filter runs forward through time: at each point it predicts the state, then corrects that prediction with the new observation. A backward smoothing pass then revises earlier state estimates using later observations as well, so the estimated components draw on the full series.
History
Kalman's 1960 paper introduced the recursive filter for linear-Gaussian state-space systems. Harvey's 1989 book set out structural time series models and their estimation with the Kalman filter. Durbin and Koopman's 2012 second edition consolidates modern computational methods, including exact diffuse initialisation and simulation smoothing.
When to use it
Choose the time series Kalman filter when the question concerns unobserved components (trend, seasonal, cycle, irregular) and the model can reasonably be written as linear with Gaussian disturbances. It is a natural fit when observations are missing or irregularly spaced, because the update step can be skipped at those times, and when you need an exact likelihood for maximum likelihood or Bayesian estimation of variance parameters. Structural models such as the local level and local linear trend are common starting points. Do not use the linear-Gaussian filter as it stands when the dynamics are strongly nonlinear or the observations are counts or heavy-tailed; use an Extended Kalman Filter, an Unscented Kalman Filter, or a particle filter instead. Be cautious when the series is short relative to the number of unknown parameters, since the likelihood can be flat and the estimates unstable.
Limitations and considerations
- Model assumptions: the state and observation equations are linear, the disturbances eta and epsilon are Gaussian and mutually independent, the system matrices are specified in advance or estimated, and the initial state distribution is either proper or diffuse. Each of these assumptions is needed for the recursions and the exact likelihood to hold.
- The state equations are linear and the disturbances Gaussian; count data, heavy-tailed noise or nonlinear dynamics violate these assumptions unless the filter is extended.
- The system matrices (T, Z, Q, H) must be specified, and their unknown elements must be estimated, which becomes difficult as the state dimension grows.
- The likelihood surface over the variance parameters can be multimodal or flat, so numerical optimisation may settle on poor local solutions.
- Diffuse initialisation for nonstationary components needs careful handling, and results for short series can be sensitive to it.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Missing values and irregular spacing are handled directly: when an observation is absent, the update step is skipped and the prediction carries forward.
- The filter gives the exact Gaussian log-likelihood of the state-space model, so hyperparameters can be estimated by maximum likelihood or placed under priors in a Bayesian analysis.
- Components such as trend and seasonality are extracted as explicit state elements, each with an associated uncertainty band.
- The recursion processes one time point at a time, so computation grows linearly with the number of time points for a fixed state dimension.
- The state-space framework includes ARIMA and exponential smoothing models as special cases, so these can be estimated within one recursive algorithm.
Applications
- Decomposing macroeconomic time series (GDP, inflation) into trend, cycle, and seasonal components for structural analysis.
- Estimating time-varying parameters in econometric models, such as time-varying betas in asset pricing.
- Nowcasting: combining high-frequency indicators to estimate low-frequency quantities (e.g., monthly GDP) in real time.
- Interpolating and forecasting irregularly sampled or partially observed time series in climatology, epidemiology, and finance.
- Signal extraction in engineering and signal processing contexts with known or estimated noise covariances.
- Fitting and forecasting with exponential smoothing and ARIMA models via their state-space representations.
How it works
How it works
The series is written in state-space form. The state vector alpha_t collects latent quantities such as level, slope and seasonal components, and evolves through the transition matrix T_t with disturbance eta_t entering through R_t. The observation equation links the state to the observed value y_t through Z_t, plus measurement error epsilon_t. Local level, local linear trend and basic structural models are special cases of this form.
Formula
\alpha_{t+1} = T_t \alpha_t + R_t \eta_t, \quad y_t = Z_t \alpha_t + \varepsilon_tStarting from the previous filtered state a_{t-1} and its covariance P_{t-1}, the filter propagates both one step ahead using T_{t-1}. The predicted covariance adds the process noise term R Q R', which is why uncertainty grows between observations when Q is positive.
Formula
a_{t|t-1} = T_{t-1} a_{t-1}, \quad P_{t|t-1} = T_{t-1} P_{t-1} T_{t-1}^\top + R_{t-1} Q R_{t-1}^\topThe innovation v_t is the observed value minus its one-step-ahead prediction. Its variance F_t combines the predicted state uncertainty, mapped through Z_t, with the observation-noise term H. The innovations and their variances are the quantities from which the Gaussian likelihood is built, and they are also the basis of the residual diagnostics used to check the model.
Formula
v_t = y_t - Z_t a_{t|t-1}, \quad F_t = Z_t P_{t|t-1} Z_t^\top + HThe gain P Z' F^{-1} determines how strongly the innovation corrects the prediction: greater predicted uncertainty or smaller observation noise produces a larger correction. This gives the filtered state a_t and the reduced covariance P_t. When an observation is missing, the update is skipped and the prediction carries forward.
Formula
a_t = a_{t|t-1} + P_{t|t-1} Z_t^\top F_t^{-1} v_t, \quad P_t = P_{t|t-1} - P_{t|t-1} Z_t^\top F_t^{-1} Z_t P_{t|t-1}After the forward pass is complete, a backward recursion runs through the series. It uses the innovations and their variances stored during the forward pass, together with information from later observations, to revise each filtered state estimate. The smoothed estimates are generally more precise than the filtered estimates, which is why they are the usual basis for retrospective component extraction.
Formula
\hat{\alpha}_t = a_t + P_t r_t, \quad r_{t-1} = Z_t^\top F_t^{-1} v_t + T_t^\top r_tCommon pitfalls
- Fixing the process noise variance Q at zero collapses the model to deterministic dynamics, so the filter can no longer track changes in level or slope.
- Skipping residual diagnostics on the innovations: non-normality, autocorrelation or changing variance in the standardised innovations indicate model misspecification.
- Reporting filtered estimates when component extraction requires smoothed ones: filtered estimates use only past observations and are therefore noisier.
- Estimating the variance parameters and then inferring states on the same data without acknowledging that the estimated parameters add uncertainty.
- Applying the linear Kalman filter to count or bounded observations without a suitable transformation or a nonlinear extension.
Frequently asked questions
What is the difference between filtering and smoothing?
Filtering produces the state estimate a_t using only observations up to time t, making it suitable for real-time applications. Smoothing (e.g., the Kalman smoother) re-runs a backward pass after the full forward filter and uses all observations to refine each state estimate, reducing uncertainty. Use smoothed estimates for historical component extraction; use filtered estimates for online forecasting.
How are hyperparameters (Q, H) estimated?
Unknown variance parameters are typically estimated by maximising the Gaussian log-likelihood formed from the innovations and innovation variances produced by the Kalman filter. This can be done with numerical optimisation (e.g., L-BFGS-B) or, in a fully Bayesian framework, by placing priors on the variances and sampling with MCMC.
Can the Kalman filter handle non-Gaussian or count data?
Not directly. For non-Gaussian observation distributions (Poisson counts, binary data), the exact Kalman filter no longer applies. Extensions include the Extended Kalman Filter (linearisation), the Unscented Kalman Filter (sigma-point approximation), and particle filters (sequential Monte Carlo), all of which preserve the state-space structure while relaxing the Gaussian assumption.
How does the state-space approach relate to ARIMA models?
Every ARIMA(p,d,q) model can be written in state-space form and estimated via the Kalman filter. The state-space representation is more general, however: it accommodates structural components, multiple observation series, time-varying coefficients, and missing data within the same recursive algorithm.
What is diffuse initialisation and why does it matter?
When the initial state is nonstationary (e.g., a random-walk trend with unknown starting level), the initial variance is effectively infinite, so a proper prior cannot be written down directly. Diffuse initialisation handles this within the filter, as implemented in standard state-space software, rather than by inserting an arbitrary large value into P_0. A naive large P_0 can distort the likelihood and parameter estimates for short series, so check the sensitivity of results to the initial prior.
Related methods
Sources
Durbin, J. & Koopman, S. J. (2012). Time Series Analysis by State Space Methods (2nd ed.). Oxford University Press.
ISBN: 978-0199641178Harvey, A. C. (1989). Forecasting, Structural Time Series Models and the Kalman Filter. Cambridge University Press.
ISBN: 978-0521321969