The Kalman filter
The Kalman filter integrates the states of a linear-Gaussian chain out one at a time, so that what is left on each state is its prediction and, with its measurement, its update; its gain weighs the innovation, its evidence is the product of the innovations' densities, and in information or square-root form it is elimination along the chain, which carries a state its measurements do not yet determine.
A quantity that changes over time is a chain of states, each following the one before it, each measured. To know the latest state is to integrate every earlier one out, and when the chain is linear and Gaussian what that leaves is a normal on the latest state, which the next state’s integral starts from. That recursion is the Kalman filter [Kalm60]. This note states it in the form it is usually written, proves it from the integral, and then writes it as the elimination it is, which needs no covariance and so carries a state that the measurements do not yet determine.
The filter#
Let states in and measurements follow the linear-Gaussian chain
with , and positive definite, and let the measurements be observed at . Set and , and for each
Then integrating , in that order, out of the terms that read only them and , the prior, the motions up to and the measurements at their values, leaves on the factor
and with also observed, the posterior of given is .
By induction on . For the factor is the prior, with no evidence. Suppose the factor on is as stated. With observed, the terms that read are that factor and the measurement’s , and their sum, as a function of , is a factor of full rank, since is positive definite. By Proposition 2 it is a normal with the precision and the information vector
and these agree with the statement’s covariance form. Dropping the index , , so . Then
The integral of the sum over is the density of when and with independent: a normal with mean and covariance , at , which is . So the sum is plus that evidence, which is also the posterior of the statement. Adding the motion and integrating out leaves the density of with and independent, the normal , and the evidence is carried along unchanged.
∎The names are the filter’s own. is the prediction of the state from the measurements before it, and its update by its own measurement. The innovation is the measurement’s residual at the prediction, the part of it that the past did not foresee, its covariance, and the gain the weight the update gives it: near zero when the measurement is noisy against the prediction, and near the weight that makes the update reproduce the measurement, , when it is precise. The constant left over is the evidence, the density of all the measurements so far, a product of the innovations’ densities.
The scalar case. Take , and , and integrate out with observed at . Writing for the normal density of mean and variance at ,
The update moves the prior’s mean toward the measurement by the fraction of the innovation, and shrinks its variance by the same fraction; the prediction keeps the mean and adds the motion’s variance.
The filter as elimination#
The covariance form needs a covariance, and a state that its measurements do not yet determine has none. The information form (2) needs only a precision and an information vector, which is what the normal equations are, and it adds measurements by adding to them. Its prediction, integrating the state out of the update and the motion, is the integral of Proposition 1, which leaves a factor of any rank. So the information form starts from no prior at all, carries a state that is determined along some directions only, and becomes a normal at the first step whose factor has full rank.
The square-root form goes one step further and keeps the factors as rows. At each step it stacks the rows of the factor left on , of the measurement, whitened by , and of the motion, whitened by , and eliminates the block of by an orthogonal factorization, which leaves the rows of a factor on . That is elimination of the chain in its own order, the order of a path, in which no block’s elimination creates fill: each step is a dense factorization of a few blocks, and its cost does not grow with the chain. It works at the condition number of the rows, and not, as the covariance form’s subtraction does, at that of the matrices built from them.
What the filter is not. The filter’s update is the posterior of the state given the measurements so far. Elimination along the chain, followed by back substitution from the last state to the first, gives instead the mode of every state given every measurement, the minimizer of the whole chain’s objective; on a linear-Gaussian chain that is the mean of each state’s posterior given all the data, the smoothed mean, which a filter, looking only backward, does not compute. And on a chain whose means are not linear, the filter that linearizes each step at its prediction takes one Gauss–Newton step per state, from that prediction, and is not the mode of anything: it is exact where the linearization is.
References
- [Kalm60] R. E. Kalman. A New Approach to Linear Filtering and Prediction Problems. Journal of Basic Engineering 82(1), 35–45. 1960.
Built on by
- Optimization and estimation, term by term The notes on least squares and Gaussian approximations name most things twice, once as an optimizer would and once as a state estimator would; this table sets the two names side by side, row by row, with the note that defines each.