|MATLAB MEX Function Reference|
The Kalman filter provides a tool for dealing with state space models to analyse economic and financial time series of not only correlated its past values but also contemporaneously correlated each other and each other's past values. You can develop a model of the univariate or multivariate time series and the relationships between the vector time series.
logl = kalcvf(data, lead, a, F, b, H, var) logl = kalcvf(data, lead, a, F, b, H, var, z0, vz0) [logl, pred, vpred] = kalcvf(data, lead, a, F, b, H, var) [logl, pred, vpred] = kalcvf(data, lead, a, F, b, H, var, z0, vz0) [logl, pred, vpred, filt, vfilt] = kalcvf(data, lead, a, F, b, H, var) [logl, pred, vpred, filt, vfilt] = kalcvf(data, lead, a, F, b, H, var, z0, vz0)
KALCVF computes the one-step prediction
and the filtered estimate
, as well as their covariance matrices.
The function uses forward recursions, and you can also use it to obtain k-step estimates.
The inputs to the KALCVF function are as follows:
The function returns the following output:
AlgorithmThe KALCVF function computes the conditional expectation of the state vector zt given the observations, assuming that the mean and the variance of the initial state vector are known. The filtered value is the conditional expectation of the state vector zt given the observations up to time t. For k-step forecasting where k>0, the conditional expectation at time t+k is computed given observations up to t. For notation, Vt and Rt are variances of and , respectively, and Gt is a covariance of and . A- stands for the generalized inverse of A. The filtered value and its covariance matrix are denoted and , respectively. For k>0, and stand for the k-step forecast of zt+k and its mean square error. The Kalman filtering algorithm for one-step prediction and filtering is given as follows:
RemarksThe initial state vector and its covariance matrix of the time invariant Kalman filters are computed under the stationarity condition
KALCVS performs fixed-interval smoothing
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