Superclasses:
Create diffuse state-space model
dssm
creates a linear diffuse state-space model with independent Gaussian state disturbances and observation innovations. A diffuse state-space model contains diffuse states, and variances of the initial distributions of diffuse states are Inf
. All diffuse states are independent of each other and all other states. The software implements the diffuse Kalman filter for filtering, smoothing, and parameter estimation.
You can:
Specify a time-invariant or time-varying model.
Specify whether states are stationary, static, or nonstationary.
Specify the state-transition, state-disturbance-loading, measurement-sensitivity, or observation-innovation matrices:
Explicitly by providing the matrices
Implicitly by providing a function that maps the parameters to the matrices, that is, a parameter-to-matrix mapping function
After creating a diffuse state-space model containing unknown parameters, you can estimate its parameters by passing the created dssm
model object and data to estimate
. The estimate
function builds the likelihood function using the diffuse Kalman filter.
Use a completely specified model (that is, all parameter values of the model are known) to:
creates a diffuse state-space model (Mdl
= dssm(A
,B
,C
)Mdl
) using state-transition matrix A
, state-disturbance-loading matrix B
, and measurement-sensitivity matrix C
.
creates a diffuse state-space model using state-transition matrix Mdl
= dssm(A
,B
,C
,D
)A
, state-disturbance-loading matrix B
, measurement-sensitivity matrix C
, and observation-innovation matrix D
.
uses any of the input arguments in the previous syntaxes and additional options that you specify by one or more Mdl
= dssm(___,Name,Value
)Name,Value
pair arguments.
creates a diffuse state-space model using a parameter-to-matrix mapping function (Mdl
= dssm(ParamMap
)ParamMap
) that you write. The function maps a vector of parameters to the matrices A
, B
, and C
. Optionally, ParamMap
can map parameters to D
, Mean0
, Cov0
. To specify the types of states, the function can return StateType
. To accommodate a regression component in the observation equation, ParamMap
can also return deflated observation data.
converts a state-space model object (Mdl
= dssm(SSMMdl
)SSMMdl
) to a diffuse state-space model object (Mdl
). dssm
sets all initial variances of diffuse states in SSMMdl.Cov0
to Inf
.
Value. To learn how value classes affect copy operations, see Copying Objects.
Specify ParamMap
in a more general or complex setting, where, for example:
The initial state values are parameters.
In time-varying models, you want to use the same parameters for more than one period.
You want to impose parameter constraints.
You can create a dssm
model object that does not contain any diffuse states. However, subsequent computations, for example, filtering and parameter estimation, can be inefficient. If all states have stationary distributions or are the constant 1, then create an ssm
model object instead.
Default values for Mean0
and Cov0
:
If you explicitly specify the state-space model (that is, you provide the coefficient matrices A
, B
, C
, and optionally D
), then:
For stationary states, the software generates the initial value using the stationary distribution. If you provide all values in the coefficient matrices (that is, your model has no unknown parameters), then dssm
generates the initial values. Otherwise, the software generates the initial values during estimation.
For states that are always the constant 1, dssm
sets Mean0
to 1 and Cov0
to 0
.
For diffuse states, the software sets Mean0
to 0 and Cov0
to Inf
by default.
If you implicitly specify the state-space model (that is, you provide the parameter vector to the coefficient-matrices-mapping function ParamMap
), then the software generates the initial values during estimation.
For static states that do not equal 1 throughout the sample, the software cannot assign a value to the degenerate, initial state distribution. Therefore, set static states to 2
using the name-value pair argument StateType
. Subsequently, the software treats static states as nonstationary and assigns the static state a diffuse initial distribution.
It is best practice to set StateType
for each state. By default, the software generates StateType
, but this behavior might not be accurate. For example, the software cannot distinguish between a constant 1 state and a static state.
The software cannot infer StateType
from data because the data theoretically comes from the observation equation. The realizations of the state equation are unobservable.
dssm
models do not store observed responses or predictor data. Supply the data wherever necessary using the appropriate input or name-value pair arguments.
Suppose that you want to create a diffuse state-space model using a parameter-to-matrix mapping function with this signature:
[A,B,C,D,Mean0,Cov0,StateType,DeflateY] = paramMap(params,Y,Z)
Mdl = dssm(@(params)paramMap(params,Y,Z))
Y
and predictor data Z
are not input arguments in the anonymous function. If Y
and Z
exist in the MATLAB Workspace before you create Mdl
, then the software establishes a link to them. Otherwise, if you pass Mdl
to estimate
, the software throws an error.The link to the data established by the anonymous function overrides all other corresponding input argument values of estimate
. This distinction is important particularly when conducting a rolling window analysis. For details, see Rolling-Window Analysis of Time-Series Models.
Create an ssm
model object instead of a dssm
model object when:
The model does not contain any diffuse states.
The diffuse states are correlated with each other or to other states.
You want to implement the standard Kalman filter.
[1] Durbin J., and S. J. Koopman. Time Series Analysis by State Space Methods. 2nd ed. Oxford: Oxford University Press, 2012.