Note: This page has been translated by MathWorks. Please click here

To view all translated materials including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materials including this page, select Japan from the country navigator on the bottom of this page.

**Class: **dssm

Forward recursion of diffuse state-space models

`X = filter(Mdl,Y)`

`X = filter(Mdl,Y,Name,Value)`

```
[X,logL,Output]
= filter(___)
```

returns filtered states (`X`

= filter(`Mdl`

,`Y`

)`X`

)
by performing forward recursion of the fully specified diffuse state-space
model `Mdl`

. That is, `filter`

applies
the diffuse 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`

pair
arguments. For example, specify the regression coefficients and predictor
data to deflate the observations, or specify to use the univariate
treatment of a multivariate model.

If `Mdl`

is not fully specified, then you must
specify the unknown parameters as known scalars using the `'`

`Params`

`'`

`Name,Value`

pair
argument.

`[`

additionally returns 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

`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 pair arguments.It is a best practice to allow

`dssm.filter`

to determine the value of`SwitchTime`

. However, in rare cases, you might experience numerical issues during estimation, filtering, or smoothing diffuse state-space models. For such cases, try experimenting with various`SwitchTime`

specifications, or consider a different model structure (e.g., simplify or reverify the model). For example, convert the diffuse state-space model to a standard state-space model using`ssm`

.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.

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.The diffuse Kalman filter requires presample data. If missing observations begin the time series, then the diffuse Kalman filter must gather enough nonmissing observations to initialize the diffuse states.

For diffuse state-space models,

`filter`

usually switches from the diffuse Kalman filter to the standard Kalman filter when the number of cumulative observations and the number of diffuse states are equal. However, if a diffuse state-space model has identifiability issues (e.g., the model is too complex to fit to the data), then`filter`

might require more observations to initialize the diffuse states. In extreme cases,`filter`

requires the entire sample.

[1] Durbin J., and S. J. Koopman. *Time Series
Analysis by State Space Methods*. 2nd ed. Oxford: Oxford
University Press, 2012.

Was this topic helpful?