MATLAB MEX Function Reference
Fixed-interval Smoothing (kalcvs.m)

Fixed-interval smoothing is concerned with the smoothing of a finite set of data, i.e., with obtaining {z}_{t| T} for fixed T and all t in the interval t = 1, ... , T.



KALCVS uses backward recursions to compute the smoothed estimate {z}_{t| T} and its covariance matrix, {P}_{t| T}, where T is the number of observations in the complete data set.

The inputs to the KALCVS function are as follows.

The KALCVS function returns the following values:


When the Kalman filtering is performed using KALCVF function, the KALCVS function computes smoothed state vectors and their covariance matrices. The fixed-interval smoothing state vector at time t is obtained by the conditional expectation given all observations.

The smoothing algorithm uses one-step forecasts and their covariance matrices, which are obtained using KALCVF function. For notation, {z}_{t| T} is the smoothed value of the state vector zt, and the mean square error matrix is denoted {P}_{t| T}. For smoothing,
\hat{\epsilon}_t & = & {y}_t - {b}_t - {H}_t {z}_{t| t-1} \
{D}_t & = & {H}_t ...
 ...{t-1} \
{P}_{t| T} & = & {P}_{t| t-1} - {P}_{t| t-1} {U}_{t-1}
 {P}_{t| t-1}
where t = T, T-1, ... , 1. The initial values are uT = 0 and UT = 0.

When the SSM is specified using the alternative transition equation
{z}_t = {a}_t + {F}_t{z}_{t-1} + \eta_t
the fixed-interval smoothing is performed using the following backward recursions:
\hat{\epsilon}_t & = & {y}_t - {b}_t - {H}_t {z}_{t| t-1} \
{D}_t & = & {H}_t ...
 ...{t-1} \
{P}_{t| T} & = & {P}_{t| t-1} - {P}_{t| t-1} {U}_{t-1}
 {P}_{t| t-1}
where it is assumed that Gt = 0.

You can use the KALCVS function regardless of the specification of the transition equation when Gt = 0. Harvey (1991) gives the following fixed-interval smoothing formula, which produces the same smoothed value:
{z}_{t| T} & = & {z}_{t| t} + {P}^*_t ({z}_{t+1| T} - {z}_{t+1| t}) \
{P}_{t| T} & = & {P}_{t| t} + {P}^*_t ({P}_{t+1| T} - {P}_{t+1| t}) {P}^{*'_t
{P}^*_t = {P}_{t| t} {F}^'_t {P}^-_{t+1| t}
under the shifted transition equation, but
{P}^*_t = {P}_{t| t} {F}^'_{t+1} {P}_{t+1| t}^-
under the alternative transition equation.

The KALCVS function is accompanied by the KALCVF function, as shown in the following code. Note that you do not need to specify UN and VUN.

You can also compute the smoothed estimate and its covariance matrix on an observation-by-observation basis. When the SSM is time invariant, the following example performs smoothing. In this situation, you should initialize UN and VUN as matrices of value 0.

See also

KALCVF performs covariance filtering and prediction

Getting Started with State Space Models

Kalman Filtering Example 1: Likelihood Function Evaluation

Kalman Filtering Example 2: Estimating an SSM Using the EM Algorithm


[1]  Harvey, A.C., Forecasting, Structural Time Series Models and the Kalman Filter, Cambridge: Cambridge University Press, 1991.

[2]  Anderson, B.D.O., and J.B. Moore, Optimal Filtering, Englewood Cliffs, NJ: Prentice-Hall, 1979.

[3]  Hamilton, J.D., Time Series Analysis, Princeton, 1994.

Return to main page