The fair value of a thinly traded bond is not observed directly. Each trade reports a price equal to that value plus noise from the bid-ask spread and the size of the order, while the value itself drifts from day to day. How far should the estimate move when a new trade price arrives, and how uncertain is it afterward? This lesson writes the problem as a state-space model, derives the Kalman gain from a minimum-error update and from Gaussian conditioning, and runs two filtering steps with exact fractions.
Key terms
State-space model
Definition A linear state-space model describes a latent state in and an observation in by two equations. The state equation and the observation equation are
for , where the transition matrix is , the observation matrix is , and the process noise and the observation noise have mean zero and covariance matrices
which are positive semidefinite of sizes and . On this page the matrices are known, the initial state is , the noises are Gaussian with and , and , all and all are mutually independent. Known matrices that change with work the same way date by date. A known intercept, such as a drift in , can be carried as a separate term or by adding a constant component to the state. Correlated process and observation noise and nonlinear equations are outside this lesson.
In plain words The state equation says how the hidden quantity moves from one date to the next, and the observation equation says how a measurement relates to it. The matrix measures how much the state moves unpredictably in one step, and measures how noisy each measurement is.
Example A constructed model for the fair value of a bond and its trade price , both in the same price units, is the local level model with ,
with and in squared price units and . The fair value is a random walk, and each trade price is the fair value plus noise. A model whose state holds a level and a drift observed through one price would instead have a matrix , a matrix , a matrix and a matrix .
Latent state
Definition The state is latent because it is never observed. Only the observations are seen, and denotes the information generated by , with containing no observations. Under the model’s probability , estimating from means computing and the conditional covariance of its error. The problem is prediction when , filtering when and smoothing when . Write
where the superscript minus marks the prediction made before arrives, not a negative value, and and are the initial mean and covariance. Because has mean zero and is independent of and together, conditioning the state equation on gives the one-step prediction
The prediction error is the sum of two pieces that are independent given . The first, with covariance , carries the uncertainty already present through the dynamics, and the second adds the new process noise .
In plain words A filtered estimate uses the data up to its own date, a prediction uses only earlier data, and a smoothed estimate also uses later data. A smoothed value is useful for studying the past, but treating it as known at its own date brings future information into a backtest. Between observations, the dynamics move the mean and carry the uncertainty forward, and the process noise adds more.
Example In the bond model, and , so the prediction for date is with . With the constructed prices and , worked through in the last card, the filtered estimate of the date-1 state is with variance , and the prediction of the date-2 state from the same information is with the larger variance . Conditioning the same Gaussian model on both prices gives the smoothed estimate with variance . Its error variance is smaller than that of the filtered estimate , but it was not available at date .
Innovation covariance
Definition The innovation at date is the part of the observation that the prediction did not expect,
where is the state prediction error. Since is independent of , the innovation covariance and the cross-covariance of the state error with the innovation are
The matrix is and positive semidefinite, and it is invertible whenever is positive definite. In the Gaussian model, given has the distribution , and the innovations at different dates are independent. The joint density of is therefore the product of the densities evaluated at , which is how the likelihood of a state-space model is computed when its parameters are estimated.
In plain words The innovation is the surprise in the new measurement. Its covariance has two sources, the uncertainty about the state as seen through and the noise of the measurement itself. A surprise is large or small only relative to .
Example In the bond model at date , the predicted price is and the observed price is , so . The innovation variance and the cross-covariance are
Here is simply the variance of , which is , and the standardized surprise is . At date the innovation is with , a standardized surprise of about .
Kalman gain
Definition Assume is invertible. Among updates of the form with a fixed matrix , the error has covariance
The Kalman gain is
and completing the square around it gives
The last term is positive semidefinite for every , so gives the smallest error covariance in the matrix order, and in particular the smallest mean squared error . The updated mean is
In the Gaussian model, and are jointly normal given . The conditional mean of a jointly normal vector is affine in the conditioning variable and has the smallest mean squared error among all estimates, so it coincides with this update, and is exactly . For a scalar state observed directly, with , and , multiplying the prior density by the likelihood of and completing the square in the exponent gives a normal posterior with precision and mean
so the gain is the share of the total variance that comes from the prediction. With fixed, the gain tends to as and to as .
In plain words The gain decides how far the estimate moves toward the new measurement. It is large when the prediction is uncertain compared with the measurement, and small when the measurement is noisy compared with the prediction. It is a ratio of variances inside the model, not a judgment about how far the data deserve to be trusted outside it.
Example At date of the bond model, , so the estimate moves five ninths of the way from the prediction toward the price , and . The precision form gives the same mean, since and . With the same prediction, a much noisier price with would give , and a nearly exact price with would give .
Posterior covariance
Definition The posterior covariance is the error covariance after the update, which in the Gaussian model is . With the Kalman gain,
For an arbitrary gain , the error has the Joseph form covariance
a sum of two positive semidefinite terms, one for the prediction error that the update leaves and one for the measurement noise that it lets in. The Joseph form holds for every . The shorter expression comes from substituting , and for other gains it generally gives the wrong covariance. The Joseph form also helps keep a computed covariance symmetric and positive semidefinite under rounding. In the Gaussian model, does not depend on the observed values, so the whole sequence can be computed before any data arrive. When and are invertible, the precisions add,
In plain words After the update, the uncertainty is the predicted uncertainty minus the part the measurement explained. The Joseph form tells the same story as a sum, the prediction error the gain did not remove plus the measurement noise the gain let in. When the predicted covariance is positive definite, even a noiseless measurement removes the uncertainty only in the combinations of the state that it measures.
Example At date of the bond model, . The Joseph form gives the same value,
and so does the precision form, . In this scalar model with the posterior variance equals , which here is the gain itself because . The value would be the same whatever price had been observed at date .
Kalman filter
Definition The Kalman filter is the recursion that starts from and and, for , alternates a prediction and an update,
Under the Gaussian assumptions of the state-space card, and with every invertible, induction on with the Gaussian update of the gain card shows that the conditional distribution of given is exactly . If and the noises are only mutually uncorrelated with the stated means and covariances, the same recursion gives the best estimate of among those affine in , with error covariance , but the true conditional distribution need not be normal and its mean may differ from . Correlated process and observation noise needs extra cross-covariance terms, and nonlinear models need a separate argument or an approximation.
In plain words Predict with the dynamics, compare the new measurement with what was expected, and move the estimate by the gain times the surprise. Each date uses its own gain, computed from the uncertainty just before its own observation.
Example In the bond model with the constructed prices and , the two steps are
| Date | |||||||
|---|---|---|---|---|---|---|---|
At date the prediction keeps the mean , because , and adds to the variance, . The innovation is , and
The second gain is smaller than the first, , because the prediction before the second price is more precise than the one before the first. Conditioning the joint normal distribution of , and directly gives the same mean and variance .
Check yourself
- A scalar state with and has filtered mean and variance . The process variance is , the observation variance is and the next observation is . Find the predicted variance, the innovation variance, the gain, and the updated mean and variance.
Show the answer
The prediction keeps the mean at and raises the variance to . The innovation variance is , so the gain is . The innovation is , which gives
As a check, the precisions add, .
- In the two-step bond example, a classmate reuses the first gain at date instead of computing , and reports the error variance . Find the classmate’s estimate and its true error variance, and explain both mistakes.
Show the answer
With the old gain the estimate is instead of . The gain must be recomputed because the uncertainty before the second price, , differs from the uncertainty before the first. The short formula holds only for the optimal gain, so the reported is not the error variance of this estimate. The Joseph form holds for any gain and gives
This exceeds the optimal by , as the completed square says. The reused gain does worse than , while the short formula reports a number even below the optimum.
- Two latent fair values form the state , with predicted mean and predicted covariance . Only the sum is observed, without noise, so and , and the observed sum is . A classmate says that a measurement without noise leaves no uncertainty. Find the gain, the updated mean and the posterior covariance, and check the claim.
Show the answer
The innovation covariance is , which is invertible even though , so
The innovation is , so the updated mean is , and the posterior covariance is
The claim is false. With and , the sum has posterior variance , so it is known exactly, but the difference has variance , the same as before the measurement, and each fair value still has variance . A noiseless measurement removes the uncertainty only in the combination of the state that it observes, and here the posterior covariance has rank .