Kalman filtering and estimation error
Combine a dynamical prediction with a noisy observation while distinguishing covariance bookkeeping from actual model accuracy.
On this page
The question for today
What you’ll understand
- Apply discrete-time prediction and measurement-update equations with consistent indexing.
- State the independence and Gaussian assumptions behind conditional-mean optimality.
- Interpret innovation and covariance without mistaking confidence for correctness.
A prediction carries uncertainty forward, while a sensor supplies new but imperfect information. The Kalman filter combines them according to their modeled covariances. A large measurement disagreement does not automatically mean the sensor is wrong: the model could be wrong instead. The filter’s gain expresses a particular probabilistic assumption about both errors. We use a discrete-time linear state model and separate the estimate before a measurement from the estimate after it. This notation avoids the common mistake of applying a gain computed for one covariance to an estimate representing a different information set.
Predict the state and its uncertainty together
Let x_{k+1}=Ax_k+Bu_k+w_k and y_k=Cx_k+v_k. Assume zero-mean process and measurement noises, independent across time and mutually independent, with covariances W≥0 and R>0; the initial state is independent of all noises with specified mean and covariance. Inputs are deterministic and known to the estimator. For conditional-mean optimality among all estimators, assume the initial state and noises are jointly Gaussian under these independence assumptions. With only second moments, the same recursion gives the best linear least-squares estimate, which need not equal the unrestricted conditional mean.
After processing data through time k−1, the prediction for time k propagates the previous updated estimate through A and adds the known input. Its covariance becomes A P_{k−1}^+ Aᵀ+W. Process noise is added because it represents new uncertainty, not a measurement one can subtract. Covariance propagation accounts for correlations between state coordinates; propagating only separate variances can lose important information about which combinations are well known. A deterministic control input affects the predicted mean but does not itself add covariance in this model.
Use the innovation to correct the prediction
The innovation is the actual measurement minus its predicted value. Its covariance S includes both projected state uncertainty and sensor uncertainty. The gain K=P^-CᵀS^{-1} maps this discrepancy back into state coordinates. The updated estimate adds K times the innovation, and its error covariance decreases according to the update formula. In exact arithmetic the simplified covariance update is equivalent to the Joseph form, which explicitly includes both remaining prediction error and injected measurement noise. The latter is often preferable numerically because its positive-semidefinite structure is more visible.
For scalar direct measurement, K=P^-/(P^-+R). A more uncertain prediction gets a larger correction; a noisier sensor gets a smaller one. This is a model-based weighting, not an adaptive verdict that the larger observed number must be more reliable. Correlated process and measurement noise require modified cross-covariance terms. Reusing these independent-noise equations in that setting can understate or misallocate uncertainty. Similarly, repeatedly assimilating the same measurement as if it were independent counts the same information more than once.
Estimation quality depends on the model
Under the Gaussian model, P⁺ is the actual covariance conditional on the observed data. With only second moments it is the unconditional error covariance of the best linear estimator, generally not the data-conditional covariance. For independent equally likely signs X and v, observing Y=X+v gives the linear-error variance 1/2, but Var(X|Y=2)=0 and Var(X|Y=0)=1. An unmodeled sensor bias can also make an estimate systematically wrong despite a small reported covariance. Innovation checks compare residual scale and correlation with the assumed model; they do not identify the source of every mismatch or independently measure ground-truth error.
Detectability is relevant to whether hidden unstable modes can be estimated over long runs. Under standard time-invariant assumptions, suitable detectability and process-noise stabilizability conditions support a stabilizing steady-state Riccati filter, but the finite recursion here does not require one to assert a constant gain prematurely. Time-varying sensors or noise covariances can keep the gain time dependent. Combining estimation with feedback also introduces performance and robustness questions beyond this estimator calculation. The full-state LQR gain and an estimator gain solve different Riccati problems and should not be interchanged merely because their algebra looks similar.
Work it through
Two carefully indexed updates
A scalar state has prior mean 2 and variance 4. A direct measurement is 5 with noise variance 1. Update it, then predict through A=0.5 with process variance 0.2 and assimilate measurement 3 with noise variance 0.6.
For the first measurement, gain is 4/(4+1)=0.8. The updated estimate is 2+0.8(5−2)=4.4 and error variance is (1−0.8)·4=0.8.
The next prediction has mean 0.5·4.4=2.2 and variance 0.25·0.8+0.2=0.4. This is a new pre-measurement covariance.
The next gain is 0.4/(0.4+0.6)=0.4. The updated estimate becomes 2.2+0.4(3−2.2)=2.52 and error variance becomes (1−0.4)·0.4=0.24.
Prediction and assimilation use different covariances. Reusing the first gain 0.8 at the second observation would not be optimal under the specified model.
The living notebook
Explore the model
Interactive lab · sampling
A controlled uncertainty comparison
Pause and Reset, then set Bernoulli p=0.5 and sample size n=20. Predict sample-mean variance 0.25/20=0.0125. For a fresh comparison Reset and set p=0.5,n=80; predict variance 0.003125. Compare the spread of the exact bars. This independent-Bernoulli sampling model is not a Kalman filter; it isolates how assumptions and sample count determine a modeled uncertainty rather than an observed guarantee of accuracy.
- Mean sample proportion
- 0.5
- Sample-mean variance
- 0.0125
- Uniform CDF error bound
- ≤ 0.1062
Exact binomial masses for the mean of n independent Bernoulli trials, compared with normal mass between adjacent half-count boundaries; normal tails outside the finite support remain outside the bars. Playback highlights outcomes, not random samples. The Berry–Esseen bound applies to standardized CDFs, not individual bars or continuity-corrected errors. At p = 0 or 1, normal comparison and that bound are disabled. Normal-CDF evaluation uses a numerical approximation with absolute error below 7.5×10⁻⁸ (at most 1.5×10⁻⁷ per interval, before rounding). Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forA narrower modeled distribution is meaningful only under the assumptions used to compute it.
Pause & reason
Check your understanding
Your turn
Try it yourself
A scalar prior has mean 0 and variance 9. Observe y=13 directly with independent zero-mean noise variance 4. Compute the gain, updated estimate and error variance, then explain what an unmodeled bias would change.
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
The scalar gain is the prior variance divided by total innovation variance. Keep the covariance distinct from the particular residual value.
Compare with the solution
The gain is 9/13. The updated estimate is (9/13)·13=9 and error variance is (1−9/13)·9=36/13. The measured value 13 changes the mean but not this covariance for the fixed linear model. If the measurement has an unmodeled nonzero bias, the assumed zero-mean model is false: the estimate can be systematically displaced, and the reported variance does not include that unknown bias error.
Keep the idea
Take it with you
- Prediction adds dynamical uncertainty; assimilation uses the innovation covariance.
- Gaussian assumptions support conditional-mean optimality; second moments support linear least-squares optimality.
- Covariance interpretation depends on Gaussian versus linear-only estimation, and excludes unmodeled bias.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.