Quant with Vahab
Quant Systems Lab · Control Systems for Quantitative Finance

Kalman Filter

A real-time state estimator that combines a model and noisy measurements in an optimal way.

Explanation

The Kalman filter estimates an unobserved state (e.g. true position or hidden trend) from noisy measurements over time.

It runs in a loop: prediction (push the state forward with the model and increase uncertainty) then update (correct with the new measurement and reduce uncertainty).

In engineering and control, it is the standard “observer” for linear systems with Gaussian noise; in finance it is used for trend/noise separation, factor estimation, and state-space models.

Conceptually, it is a recursive Bayesian estimator: every step updates a belief (mean and covariance) about the state based on model dynamics and new data.


filteringstate-spaceestimationobserver
Interactive visualisation

A one-dimensional Kalman filter tracking a drifting hidden state from noisy measurements. At each step it blends the state model (process noise q) and the observations (measurement noise r). The Kalman gain Kₖ is the weight on the new measurement.

Time step kState / measurement value3.11.60.2-1.2-2.7true state xₖestimate x̂ₖmeasurements zₖ0.00.51.0Kalman gain Kₖ (weight on measurement)
Numbers
RMSE of raw measurements vs true state ≈ 0.78
RMSE of Kalman estimate vs true state ≈ 0.43
Filter improvement (RMSE₍meas₎ / RMSE₍filt₎) ≈ 1.82×
Average Kalman gain K̄ ≈ 0.27 (average weight on the new measurement)
Interpretation

When r is large, measurements are very noisy: the red points jump around the true path. The gain Kₖ drops, the filter trusts the model more, and the blue line is smooth but reacts slowly.

When q is large, the state itself is volatile. The filter must react quickly: Kₖ rises and the estimate hugs the measurements more closely. The RMSE ratio tells you how much better the filtered estimate is than looking at raw data.

Practitioner view: in markets you can read xₖ as a hidden “fair value” or trend and zₖ as noisy trade prices. The Kalman filter is an observer from control theory: it reconstructs the unseen state from noisy signals so that a trading or risk-control policy can act on a cleaner view of the system.