State space and the Kalman filter
TS · Chapter 512 min readAsked at Two Sigma, Citadel, DE Shaw, Jump
Assumes The ARMA family: identification, estimation and forecasting.
After this lesson you should be able to
- Write a problem in state-space form.
- Describe the predict–update cycle and what the Kalman gain does.
- Say where a filter beats a rolling window.
A state-space model separates what you want to know from what you can see. The Kalman filter is the optimal way to track the first given a stream of the second, and in finance the thing you want to know is almost always a slowly changing parameter — a beta, a fair value, a hedge ratio — observed only through noise.
Equation 5.1
State-space form
The state evolves on its own and you observe a noisy function of it. Nearly every time-series model can be written this way, which is what makes the filter so general.
- Process noise — how fast the state is allowed to move.
- Observation noise — how unreliable each measurement is.
Derivation 5.2
Predict and update
Each step has two halves: extrapolate, then correct by what you saw.
Predict: the estimate moves forward and the uncertainty grows.
The Kalman gain: how much to trust this observation.
Update: move toward the surprise, in proportion to the gain.
What the gain is really doing. The Kalman gain is a ratio of uncertainties: how unsure you are about the state, against how unsure you are about the measurement. When your state estimate is stale and the observation is clean, the gain is near one and you essentially take the new reading. When you are already confident and the reading is noisy, the gain is near zero and you barely move. It is the precision-weighted average from Bayesian updating, applied recursively — and the filter is exactly the Bayesian posterior when everything is linear and Gaussian.
Example 5.3
You track a hedge ratio with state variance and observation variance , with . Your estimate is and the new observation implies . What is your updated estimate?
Show the worked solutionHide the worked solution
Worked solution
- Formula
- Substitute
- Solve
- Answer
Sanity check. The observation is four times noisier than the state estimate, so you move only a fifth of the way toward it. Raise the process noise and the filter tracks faster; raise and it smooths harder. Those two knobs are the entire tuning problem.
The rest of this lesson is in Premium
You have read the opening. 11 more sections follow, including 2 worked examples and 3 quick checks.
Nothing is charged for 7 days, and you can cancel before then. Or read The law of large numbers and the central limit theorem in full, free.