filter
Forward recursion of state-space models
Description
filter
computes state-distribution moments for each
period of the specified response data by recursively applying the Kalman
filter.
To compute updated state-distribution moments efficiently during only the final period
of the specified response data by applying one recursion of the Kalman filter, use
update
instead.
returns filtered states (X
= filter(Mdl
,Y
)X
)
from performing forward recursion of the fully specified state-space model Mdl
.
That is, filter
applies the standard Kalman filter using Mdl
and
the observed responses Y
.
uses additional options specified by one or more X
= filter(Mdl
,Y
,Name,Value
)Name,Value
arguments. For example, specify the regression coefficients and predictor data to
deflate the observations, or specify to use the square-root filter.
If Mdl
is not fully specified, then you must specify the unknown parameters
as known scalars using the
'
Params
'
Name,Value
argument.
[
uses any of the input arguments
in the previous syntaxes to additionally return the loglikelihood
value (X
,logL
,Output
]
= filter(___)logL
) and an output structure array (Output
)
using any of the input arguments in the previous syntaxes. Output
contains:
Filtered and forecasted states
Estimated covariance matrices of the filtered and forecasted states
Loglikelihood value
Forecasted observations and its estimated covariance matrix
Adjusted Kalman gain
Vector indicating which data the software used to filter
Examples
Input Arguments
Name-Value Arguments
Output Arguments
Tips
Mdl
does not store the response data, predictor data, and the regression coefficients. Supply the data wherever necessary using the appropriate input or name-value arguments.To accelerate estimation for low-dimensional, time-invariant models, set
'Univariate',true
. Using this specification, the software sequentially updates rather then updating all at once during the filtering process.
Algorithms
The Kalman filter accommodates missing data by not updating filtered state estimates corresponding to missing observations. In other words, suppose there is a missing observation at period t. Then, the state forecast for period t based on the previous t – 1 observations and filtered state for period t are equivalent.
For explicitly defined state-space models,
filter
applies all predictors to each response series. However, each response series has its own set of regression coefficients.
Alternative Functionality
To filter a standard state-space model in real time by performing one forward
recursion of the Kalman filter, call the update
function instead. Unlike filter
, update
performs minimal input validation for computational efficiency.
References
Version History
Introduced in R2014a