12 — Advanced Models

State-Space Models#

AdvancedStatistical 1 min read
◆ The PatternHidden states evolving under noise

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.

State:   xt = F·xt−1 + wt   |   Obs:   yt = H·xt + vt
The Kalman filter recursively estimates xt from noisy observations yt, balancing model prediction with measurement update.
// Interactive — Kalman filter tracking
Process Noise20
Observation Noise50
Pattern bridge: The Kalman filter is the time-series equivalent of Bayesian updating — prior × likelihood = posterior, applied recursively at each time step. In markets, the hidden state is the true “fair value” obscured by market noise.
Worked example

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.

Where it misleads
  • 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.
In code
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)}
Python, in your browser — edit the code and run it again

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)
Sources
  • 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

Linked from 1
← Previous
Prophet
Open in the full reader, with the topic sidebar