Predict, then fuse: the Kalman filter and the adaptive filters
\[ % Number sets \newcommand{\Nat}{\mathbb{N}} \newcommand{\Integer}{\mathbb{Z}} \newcommand{\Real}{\mathbb{R}} \newcommand{\Complex}{\mathbb{C}} % Operators \newcommand{\SNR}{\operatorname{SNR}} \newcommand{\tr}{\operatorname{tr}} \newcommand{\re}{\operatorname{Re}} \newcommand{\im}{\operatorname{Im}} \newcommand{\sign}{\operatorname{sign}} \newcommand{\rect}{\operatorname{rect}} \newcommand{\sinc}{\operatorname{si}} \newcommand{\erf}{\operatorname{erf}} \newcommand{\erfc}{\operatorname{erfc}} \newcommand{\kurt}{\operatorname{kurt}} \newcommand{\diag}{\operatorname{diag}} \newcommand{\MSE}{\operatorname{MSE}} \newcommand{\argmin}{\operatorname*{argmin}} \newcommand{\argmax}{\operatorname*{argmax}} \newcommand{\bias}{\operatorname{bias}} \newcommand{\Bin}{\operatorname{Bin}} % Delimiters \newcommand{\paren}[1]{\left(#1\right)} \newcommand{\bracket}[1]{\left[#1\right]} \newcommand{\set}[1]{\left\{#1\right\}} \newcommand{\abs}[1]{\left\lvert #1 \right\rvert} \newcommand{\norm}[1]{\left\lVert #1 \right\rVert} \newcommand{\ip}[1]{\left\langle #1 \right\rangle} % Notation \newcommand{\dd}{\,\mathrm{d}} \newcommand{\tran}{^{\top}} \newcommand{\conv}{\ast} \newcommand{\conj}{^{*}} \newcommand{\herm}{^{\mathsf{H}}} \newcommand{\opt}{^{\star}} % Expectation and variance % \newcommand{\E}[1]{\mathbb{E}\!\left[#1\right]} \newcommand{\E}[2][]{\mathbb{E}_{#1}\!\left[#2\right]} \newcommand{\Var}[1]{\mathbb{V}\!\left[#1\right]} % Distributions \newcommand{\Gauss}{\mathcal{N}} \newcommand{\Uniform}{\mathcal{U}} \newcommand{\FT}{\mathcal{F}} % Probability \newcommand{\Prob}[1]{\mathbb{P}\!\left(#1\right)} % Misc \newcommand{\bsy}[1]{\boldsymbol{#1}} \newcommand{\calR}{\mathcal{R}} \newcommand{\calC}{\mathcal{C}} \]

Two problems: the data arrive one at a time, and the receiver moves, so old fixes describe a place it has left.
This week makes the projection recursive, then lets the unknown move. Only the bookkeeping is new.
Keeping up with a moving state. Sequential fusion, a state that drifts, state-space models, and the Kalman filter: predict, then fuse.
Keeping up with an unknown filter. When the unknown is a filter’s coefficients the same recursion is RLS, and the cheap gradient methods (steepest descent, LMS, NLMS) are it frozen.
One projection. A last look at the whole course.
In the notes Recursive Estimation of a Position · When the State Moves · State-Space Models · The Kalman Filter · When the Unknown is a Filter · The Other Route: Stochastic Gradient · Gradient Methods as Frozen Kalman Filters · A Unifying View: Hilbert Spaces

Read along time, each realization settles; read down the ensemble, the envelope closes as \(1/\sqrt k\). Every algorithm this week is a rule for how fast that envelope may be allowed to close.
One quantity \(S\), measured \(k\) times with independent errors of variance \(\sigma_V^2\). The sample mean need not store the readings:
Running mean \[\widehat S[k]=\widehat S[k-1]+\frac1k\paren{X[k]-\widehat S[k-1]} .\]
The gain \(1/k\) is not a choice. With \(P[k-1]=\sigma_V^2/(k-1)\), \[\frac{P[k-1]}{P[k-1]+\sigma_V^2}=\frac1k:\] the ratio of what the estimate is unsure about to the total uncertainty of the new reading.
Old estimate + gain × innovation. The innovation \(X[k]-\widehat S[k-1]\) is the part of the new reading the old estimate could not predict.
Fusion added precisions: \(\mathbf P^{-1}=\mathbf P_0^{-1}+\sum_i\mathbf H_i\herm\mathbf R_i^{-1}\mathbf H_i\). Split off the last sensor, treat everything before it as the prior, and the batch answer becomes a recursion:
Sequential fusion \[\widehat{\mathbf S}_i=\widehat{\mathbf S}_{i-1}+\mathbf K_i\,(\mathbf X_i-\mathbf H_i\widehat{\mathbf S}_{i-1}),\qquad \mathbf P_i=(\mathbf I-\mathbf K_i\mathbf H_i)\,\mathbf P_{i-1},\] \[\mathbf K_i=\mathbf P_{i-1}\mathbf H_i\herm\paren{\mathbf H_i\mathbf P_{i-1}\mathbf H_i\herm+\mathbf R_i}^{-1}=\mathbf P_i\mathbf H_i\herm\mathbf R_i^{-1}.\]
Only the last estimate and its covariance are carried. The answer after the last measurement is identical to the batch answer.
A fixed position \(\mathbf X[k]=\mathbf S+\mathbf V[k]\) with \(\mathbf R_{\mathbf{VV}}=\sigma_V^2\mathbf I\) and \(\mathbf H=\mathbf I\): the recursion is the running mean in each coordinate, and the uncertainty circle of the opening slide shrinks like \(1/\sqrt k\).
A fix taken with few satellites in view, or against a reflecting wall, is worth less. Give it its own \(\sigma_k^2\): the recursion is unchanged, and the result is the precision-weighted average of the Bayesian week. A worthless fix moves the estimate not at all, since its gain \(P/(P+\sigma_k^2)\to0\) by itself.

The running mean’s gain decays as \(1/k\): after a thousand fixes it barely moves, which is right for a fixed position and useless for a moving one.
A decaying gain is optimal for a constant and useless for a drift. Two ways to keep up: let a model re-inflate the uncertainty (Kalman), or freeze the gain (every adaptive algorithm).
Let the position drift, \(S[k]=S[k-1]+U[k]\) with independent steps of variance \(\sigma_U^2\). Between two fixes the estimate cannot know where the step went:
Scalar Kalman filter
Uncertainty now grows between measurements, so the gain no longer dies. It settles at a constant \(K_\infty\), where what one fix removes equals what one step adds.
A slow drift in a noisy sensor: small gain, long memory, heavy averaging. A fast drift or a clean sensor: gain near one, trust the latest fix. The ratio of two variances sets the memory of the tracker.
The model of a “constant that isn’t quite constant”: a wandering bias, a slowly moving target. Its variance grows without bound, which is why the estimator’s uncertainty must be allowed to grow too.

\[\mathbf S[k]=\mathbf A\,\mathbf S[k-1]+\mathbf B\,\mathbf U[k],\qquad \mathbf X[k]=\mathbf H\,\mathbf S[k]+\mathbf V[k]\]

Two equations for two questions: how the unknown moves, and how it is seen. Keeping them apart is most of the conceptual work.
Random walk: \(\mathbf A=1\); the model believes the train stays where it was.
Constant velocity State (position, velocity), random accelerations \(U\), sampling interval \(T\): \[S_p[k]=S_p[k-1]+T\,S_v[k-1]+\tfrac{T^2}{2}U[k],\qquad S_v[k]=S_v[k-1]+T\,U[k],\] \[\mathbf A=\begin{pmatrix}1&T\\0&1\end{pmatrix},\quad \mathbf B=\begin{pmatrix}T^2/2\\T\end{pmatrix},\quad \mathbf H=\begin{pmatrix}1&0\end{pmatrix}.\]
Only the position is measured. The velocity is a state nobody observes directly, and the filter will estimate it anyway.
Kalman filter Predict through the dynamics: \[\widehat{\mathbf S}[k|k-1]=\mathbf A\widehat{\mathbf S}[k-1|k-1],\qquad \mathbf P[k|k-1]=\mathbf A\mathbf P[k-1|k-1]\mathbf A\herm+\mathbf B\mathbf R_{\mathbf{UU}}\mathbf B\herm .\] Fuse the measurement, exactly as sequential fusion: \[\widehat{\mathbf S}[k|k]=\widehat{\mathbf S}[k|k-1]+\mathbf K[k]\,\bsy\nu[k],\qquad \mathbf P[k|k]=(\mathbf I-\mathbf K[k]\mathbf H)\,\mathbf P[k|k-1],\] \[\bsy\nu[k]=\mathbf X[k]-\mathbf H\widehat{\mathbf S}[k|k-1],\qquad \mathbf K[k]=\mathbf P[k|k-1]\mathbf H\herm\paren{\mathbf H\mathbf P[k|k-1]\mathbf H\herm+\mathbf R_{\mathbf{VV}}}^{-1}.\]
Nothing new in the Kalman filter
Uncertain prediction: trust the data. Noisy sensor: trust the model. The gain decides, from the two covariances alone.
The innovations \(\bsy\nu[k]\) are white: each adds one new orthogonal direction, and updating along it is exact.
Optimality of the Kalman filter The best linear estimate of the state from all measurements so far, in constant memory. For Gaussian noise, the conditional mean \(\E{\mathbf S[k]\mid\mathbf X[1],\dots,\mathbf X[k]}\): the best estimate of any kind.
Nothing is approximated: the recursion reproduces the batch answer, it only refuses to recompute it.
The gain starts near one (the prior is worthless, trust the data) and converges to a fixed blend of model and measurement. The covariance and the gain do not depend on the data: they can be computed in advance.

The random-walk model predicts “it stays where it was” and falls behind by one interval’s travel at every step. The constant-velocity model predicts the motion, and estimates a velocity no sensor measured.
Right model: white innovations of unit variance. Wrong model: correlated and too large, the filter keeps being surprised in the same direction. The innovations are the free diagnostic.
Special cases
Told the most (a model of how the unknown moves), the Kalman filter is the most powerful and the most fragile: when the model is wrong, the advantage inverts.

Let the state be the filter’s coefficients \(\mathbf w\), nearly constant (\(\mathbf A=\mathbf I\)), and let the measurement row be the input vector: \(Y[k]=\mathbf w\herm\mathbf X[k]+V[k]\). The Kalman filter on this model is recursive least squares (RLS).
RLS \[\mathbf g[k]=\frac{\beta^{-1}\mathbf P[k-1]\mathbf X[k]}{1+\beta^{-1}\mathbf X\herm[k]\mathbf P[k-1]\mathbf X[k]},\qquad \mathbf w[k]=\mathbf w[k-1]+\mathbf g[k]\,\xi\conj[k],\] \[\xi[k]=Y[k]-\mathbf w\herm[k-1]\mathbf X[k],\qquad \mathbf P[k]=\beta^{-1}\paren{\mathbf P[k-1]-\mathbf g[k]\mathbf X\herm[k]\mathbf P[k-1]}.\]
\(\mathbf P\) is the inverse of the exponentially weighted sample correlation of the inputs; the forgetting factor \(\beta<1\) re-inflates it, the role process noise plays in the Kalman filter.
RLS converges in about a filter-length of samples, whatever the input. Its price is \(O(L^2)\) per sample: at \(L=256\) taps, about 65 000 multiplications per sample.
Stronger forgetting reacts faster to the change and is noisier once settled: the same bias–variance trade as every window length in the course.
Hands-free telephony A loudspeaker plays the far-end signal \(X[k]\); the microphone picks up its echo through the room response \(\mathbf w\), plus the near-end talker, plus noise. The adaptive filter learns \(\mathbf w\) and subtracts the predicted echo.
Read as a state-space model: the room response is the state, drifting slowly as people move; the near-end talker is measurement noise.
When the near end talks, the measurement noise is large and the Kalman gain shrinks by itself: the filter stops adapting. Double-talk detection is a noise-variance estimator.

The error the algorithm minimizes is exactly the signal the far end hears. When the near end talks, that error is large for a reason the filter must not learn from.
\(J(\mathbf w)=\E{\abs{Y-\mathbf w\herm\mathbf X}^2}\) is a quadratic bowl with its bottom at the Wiener solution, and contours shaped by \(\mathbf R_{\mathbf{XX}}\). Steepest descent slides down it: \[\mathbf w[k+1]=\mathbf w[k]+\mu\paren{\mathbf r_{\mathbf{XY}}-\mathbf R_{\mathbf{XX}}\mathbf w[k]} .\]
Convergence of steepest descent It converges to \(\mathbf w\opt\) from any start if and only if \(0<\mu<2/\lambda_{\max}\); the mode along eigenvalue \(\lambda_i\) decays as \((1-\mu\lambda_i)^k\).
It still needs \(\mathbf R_{\mathbf{XX}}\) and \(\mathbf r_{\mathbf{XY}}\): the statistics-known ideal the practical algorithms approximate.

The step is capped by \(\lambda_{\max}\), so the slowest mode crawls at the rate \(\lambda_{\min}/\lambda_{\max}\). For a stationary input that spread is bounded by the dynamic range of the spectrum: a peaky spectrum makes a long, narrow valley.
AR(1) input For an input with pole \(\rho\) the spectrum runs between \(1/(1+\rho)^2\) and \(1/(1-\rho)^2\), so the eigenvalue spread approaches \(\paren{\frac{1+\rho}{1-\rho}}^2\). At \(\rho=0.9\) that is about \(361\).
Stability forces \(\mu<2/\lambda_{\max}\), and the slowest mode then needs at least \(\lambda_{\max}/(2\lambda_{\min})\approx180\) times as many iterations as the fastest, whatever \(\mu\) is chosen.
The input decides the convergence speed, not the tuning. The same number conditioned the normal equations of estimation-as-projection.
LMS \[\mathbf w[k+1]=\mathbf w[k]+\mu\,\mathbf X[k]\,e\conj[k],\qquad e[k]=Y[k]-\mathbf w\herm[k]\mathbf X[k].\]
Replace the unknown gradient by its one-sample estimate. Taking expectations, \(\E{\mathbf Xe\conj}=\mathbf r_{\mathbf{XY}}-\mathbf R_{\mathbf{XX}}\mathbf w\): LMS in the mean is steepest descent, with the same \(\mu\) and the same stability bound (under the independence assumption between weights and data).
It needs no statistics at all, two multiply-adds per tap, and is the most widely deployed adaptive filter there is. The price is gradient noise: it fluctuates around the Wiener solution, the misadjustment.
RLS whitens as it goes and does not care about the spread; LMS crawls down the valley. Samples against operations: two different currencies.
Divide the step by the input energy, \(\mathbf w[k+1]=\mathbf w[k]+\frac{\tilde\mu}{\varepsilon+\norm{\mathbf X[k]}^2}\mathbf X[k]e\conj[k]\), \(0<\tilde\mu<2\):
The normalized step is dimensionless, so its stability range no longer depends on the signal level. The regularizer \(\varepsilon\) is not a formality: in a speech pause \(\mathbf X\approx\mathbf0\) and the quotient would blow up.
Freeze the Kalman covariance at \(p\,\mathbf I\) and never update it. The RLS gain becomes \[\mathbf g[k]=\frac{\mathbf X[k]}{\norm{\mathbf X[k]}^2+\sigma_V^2/p} \;\longrightarrow\;\frac{p}{\sigma_V^2}\,\mathbf X[k]:\] NLMS with \(\varepsilon=\sigma_V^2/p\), and in the limit LMS with \(\mu=p/\sigma_V^2\).
| what is thrown away | what it costs |
|---|---|
| \(\mathbf P\) isotropic, not shaped by the input | convergence limited by \(\lambda_{\max}/\lambda_{\min}\) |
| \(\mathbf P\) never reduced by measurements | the gain never decays: misadjustment |
| \(\sigma_V^2\) constant, not estimated | no automatic slowdown when the near end talks |
| algorithm | is told | cost per step | convergence |
|---|---|---|---|
| steepest descent | \(\mathbf R_{\mathbf{XX}}\), \(\mathbf r_{\mathbf{XY}}\) | — | spread-limited; the ideal |
| LMS | nothing | \(O(L)\) | slow, spread-limited |
| NLMS | nothing | \(O(L)\) | slow, level-robust |
| RLS | nothing, estimates \(\mathbf R_{\mathbf{XX}}\) as it goes | \(O(L^2)\) | fast, spread-free |
| Kalman | a model of how the state moves | \(O(M^3)\) | optimal if the model holds |
A story about information, not cleverness: every row descends the same bowl, and pays for what it is not told.
A Hilbert space is a (complete) vector space with an inner product. That is all.
| space | elements | \(\ip{x,y}\) | orthogonal means |
|---|---|---|---|
| randomness | random variables | \(\E{XY\conj}\) | uncorrelated |
| time | finite-energy sequences | \(\sum_kx[k]y\conj[k]\) | no overlap in time |
| sensors | array snapshots | \(\mathbf y\herm\mathbf x\) | spatially orthogonal |
| frequency | spectra | \(\frac{1}{2\pi}\int XY\conj\dd\Omega\) | disjoint bands |
Choosing a Hilbert space is choosing what “similar” means for the problem. The estimator, its error and its algorithm all follow from that one choice.
Orthonormal expansion For \(\ip{e_i,e_j}=\delta_{ij}\): \(a_i=\ip{x,e_i}\), and \(\norm{x}^2=\sum_i\abs{a_i}^2\) (Parseval). No system to solve.
In \(\Complex^n\) the coordinate vector; for sequences, the DFT; for spectra, the Fourier series; for random variables in the eigenbasis of their covariance, the KLT.
So much of the course was spent manufacturing orthogonality: by rotation, by whitening, by prediction, by the Fourier transform.
For generators that are not orthonormal, the projection solves \(\mathbf G\,\mathbf a=\mathbf b\) with \(G_{ij}=\ip{x_i,x_j}\) and \(b_i=\ip{y,x_i}\). Only the inner product changes.
\(\mathbf G^{-1}\) always does the same job: it undoes what the observations share, whether that is called collinearity, correlation, coloring in time, or the signature of an interferer.
Every estimator above projected onto a linear span. One did not: the conditional mean \(\E{Y\mid\mathbf X}\) is the projection onto all functions of the data.
It is the best estimate there is, but needs the whole joint law. The linear projections need only second moments, and give up the gap between the two.
Under a Gaussian model the gap is zero That single fact is why this course could be built on second moments and still be optimal.
| level | the object | the estimate | the equation |
|---|---|---|---|
| one number | a random variable | a parameter from a sample | likelihood, posterior |
| finitely many | a random vector | one variable from others | \(\mathbf R_{\mathbf{XX}}\mathbf w=\mathbf r_{\mathbf{XY}}\) |
| a signal | a stationary process | a signal from a signal | Wiener–Hopf, \(h*R_{XX}=R_{YX}\) |
| a moving signal | a state | the state, recursively | predict, then fuse |
One idea met at four sizes: the best estimate is the orthogonal projection onto what you have observed. Everything else is choosing the space, and computing the projection efficiently.
This week