The filtering pass sequentially computes the quantities shown in Table 5 for and
.
Table 5: KFS: Filtering Phase
Here the notation denotes the conditional expectation of
given the history up to the index
:
. Similarly
denotes the corresponding conditional variance. The quantity
is set to missing whenever
is missing. Note that
are one-step-ahead forecasts only when the model has only one response variable and the data are a time series; in all other cases it is more appropriate to call them one-measurement-ahead forecasts (since the next measurement might be at the same time point). Despite this,
are called one-step-ahead predictions (and
are called one-step-ahead residuals) throughout this document. In the diffuse case, the conditional expectations must be appropriately interpreted. The vector
and the matrix
contain some accumulated quantities that are needed for the estimation of
,
, and
. Of course, when
(the nondiffuse case), these quantities are not needed. In the diffuse case, because the matrix
is sequentially accumulated (starting at
), it might not be invertible until some
. The filtering process is called initialized after
. In some situations, this initialization might not happen even after the entire sample is processed—that is, the filtering process remains uninitialized. This can happen if the regression variables are collinear or if the data are not sufficient to estimate the initial condition
for some other reason. In the diffuse case if the marginal likelihood is to be computed (see the section Likelihood Computation and Model-Fitting Phase), an additional matrix (
) is computed at each step by sequential accumulation.
The filtering process is used for a variety of purposes. One important use of filtering is to compute the likelihood of the data. In the model-fitting phase, the unknown model parameters are estimated by maximum likelihood. This requires repeated evaluation of the likelihood at different trial values of
. After
is estimated, it is treated as a known vector. The filtering process is used again with the fitted model in the forecasting phase, when the one-step-ahead forecasts and residuals based on the fitted model are provided. In addition, this filtering output is needed by the smoothing phase to produce the full-sample component estimates and for the structural break analysis.