State-space models assume a hidden state evolves over time according to a transition equation, and we observe it with noise through an observation equation. The Kalman filter optimally estimates the hidden state. ETS and ARIMA can both be written in state-space form.
In the local level model the Kalman filter settles to a fixed gain set by how noisy the state is compared with the measurements. With a signal-to-noise ratio of 0.01 the gain is 0.095; at 0.1, 0.27; at 1, 0.618; at 10, 0.916. That gain is exactly simple exponential smoothing’s α — smoothing is a Kalman filter with a particular model.
- The filter is only optimal if the noise variances are right; misjudged variances give confident but wrong estimates.
- Linear Gaussian assumptions break with outliers; one bad measurement moves the state a lot.
- Many parametrisations fit the same data; a good fit does not identify the “true” hidden states.
def steady_gain(q, r=1.0): # local level model: state noise q, observation noise r
P = (q + np.sqrt(q * q + 4 * q * r)) / 2 # steady-state prior variance
return P / (P + r) # Kalman gain = the SES smoothing weight
gains = {q: round(steady_gain(q), 3) for q in (0.01, 0.1, 1, 10)}Assumes import numpy as np and import pandas as pd. Each snippet simulates or makes up its own series, as the comments say.
The same idea with a library
# Python — Kalman-based structural model from statsmodels.tsa.statespace.structural import UnobservedComponents model = UnobservedComponents( series, level='local linear trend', seasonal=12 ).fit() forecast = model.get_forecast(steps=24)
- R. E. Kalman, “A New Approach to Linear Filtering and Prediction Problems”, Journal of Basic Engineering 82(1), 1960
- Time Series Analysis by State Space Methods (2nd ed.), J. Durbin & S. J. Koopman, Oxford University Press, 2012
- Forecasting, Structural Time Series Models and the Kalman Filter, A. C. Harvey, Cambridge University Press, 1989
Last reviewed October 2026 · How this site checks its content · Report a mistake