|MATLAB MEX Function Reference|
Fixed-interval smoothing is concerned with the smoothing of a finite set of data, i.e., with obtaining for fixed T and all t in the interval t = 1, ... , T.
[sm, vsm] = kalcvs(data, a, F, b, H, var, pred, vpred) [sm, vsm] = kalcvs(data, a, F, b, H, var, pred, vpred, un, vun)
KALCVS uses backward recursions to compute the smoothed
estimate and its covariance matrix, ,
where T is the number of observations in the complete data set.
The inputs to the KALCVS function are as follows.
AlgorithmWhen 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 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.
[logl, pred, vpred] = kalcvf(y, 0, a, F, b, H, var); [sm, vsm] = kalcvs(y, a, F, b, H, var, pred, vpred);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.
[logl, pred, vpred] = kalcvf(y, 0, a, F, b, H, var); n = size(y,2); nz = size(F,1); un = zeros(nz,1); vun = zeros(nz,nz); sm = zeros(nz,n); vsm = zeros(nz,nz,n); for i=n:-1:1 y_i = y(:,i); pred_i = pred(:,i); vpred_i = vpred(:,:,i); [sm_i, vsm_i] = kalcvs(y_i, a, F, b, H, var, pred_i, vpred_i, un, vun); sm(:,i) = sm_i; vsm(:,:,i) = vsm_i; end
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
 Harvey, A.C., Forecasting, Structural Time Series Models and the Kalman Filter, Cambridge: Cambridge University Press, 1991.
 Anderson, B.D.O., and J.B. Moore, Optimal Filtering, Englewood Cliffs, NJ: Prentice-Hall, 1979.
 Hamilton, J.D., Time Series Analysis, Princeton, 1994.
Return to main page