Idea: A number nobody can read
Latency drifts through the day, and you only see pings: the truth plus jitter.
- A single ping is too noisy
- A long average lags behind every shift
- A Kalman filter gives the best estimate now
Formula: State and reading
Process noise Q says how fast the state moves; measurement noise R how bad a reading is.
Formula: Predict
Roll the estimate forward; its uncertainty grows by Q.
Formula: Correct
Believe the share K of the surprise y − x̂⁻, then P = (1 − K) P⁻.
Example: The first ping
Start at with , and take , . A ping reads . What is the new estimate?
- Predict:
- Gain
- returns to ; estimate
Quick check: The second ping
Continue from that estimate. The next ping reads . What is the estimate now?
Show the answer
Answer:
again, gain : .
Idea: The gain is a precision share
Correcting is Bayes’ rule: precisions add, , so .
- Mean:
- Exact for linear models with Gaussian noise
- Otherwise still the best linear estimator
Common mistake: Mixing up the noises
A larger means bad readings, so the gain falls. A larger means a fast state, so it rises.
Instead And use , not : skipping predict gives , not .
Idea: The steady state
Variances ignore the readings and settle at a fixed point: .
- Check:
- At a fixed gain it is an exponential moving average
- Choosing a decay secretly chooses
Idea: Say it in the room
Recite predict and correct, and name what each noise controls.
- The gain is a precision share
- Several dimensions:
- At steady state the filter is an exponential average