A hidden state (position and velocity in 2d) moves by the linear dynamics zt = Fzt−1 + noise of variance q, and a sensor reports the position plus noise of variance r. The Kalman filter (red) uses the readings up to time t; the RTS smoother (teal) uses all of them; the fixed-lag smoother (gold) waits ℓ steps before reporting. Ellipses are 95% regions for the position. Everything is exact Gaussian inference: the only approximation is in the model.
Start: z0 ~ N((8, 10, 1, 0), 0.1 I); the filter starts from that prior. MSE is the mean over time of the squared distance between the estimated and the true position.
ch08_gaussian_filtering_smoothing.py (kalman_filter, rts_smoother, fixed_lag_smoother, Figures 8.2 and S8.1).