A state-space model is a discrete-time, stochastic model that contains two sets of equations:
One describing how a latent process transitions in time (the state equation)
Another describing how an observer measures the latent process at each period (the observation equation)
Symbolically, you can write a linear, multivariate, time-varying, Gaussian state-space model using the following system of equations
for t = 1,...,T.
is an mt-dimensional state vector describing the dynamics of some, possibly unobservable, phenomenon at period t. The initial state distribution (x0) is Gaussian with mean μ0 and covariance matrix Σ0.
is an nt-dimensional observation vector describing how the states are measured by observers at period t.
At is the mt-by-mt – 1 state-transition matrix describing how the states at time t transition to the states at period t – 1.
Bt is the mt-by-kt state-disturbance-loading matrix describing how the states at period t combine with the innovations at period t.
Ct is the nt-by-mt measurement-sensitivity matrix describing how the observations at period t relate to the states at period t.
Dt is the nt-by-ht observation-innovation matrix describing how the observations at period t combine with the observation errors at period t.
The matrices At, Bt, Ct, and Dt are referred to as coefficient matrices, and might contain unknown parameters.
is a kt-dimensional, Gaussian, white-noise, unit-variance vector of state disturbances at period t.
is an ht-dimensional, Gaussian, white-noise, unit-variance vector of observation innovations at period t.
εt and ut are uncorrelated.
is row t of a T-by-d matrix of predictors Z. Each column of Z corresponds to a predictor, and each successive row to a successive period. If the observations are multivariate, then all predictors deflate each observation.
β is a d-by-n matrix of regression coefficients for Zt.
To write a time-invariant state-space model, drop the t subscripts of all coefficient matrices and dimensions.
A diffuse state-space model is a state-space model that can contain at least one state with an infinite initial variance, called a diffuse state. In addition to having an infinite initial variance, all diffuse states are uncorrelated with all other states in the model. There are several motivations for using diffuse state-space models:
The study of very early starting points of some nonstationary systems, such as random walk process, leads to initial distribution variances that approach infinity.
An infinite variance specification for an initial state distribution indicates complete ignorance, or no prior knowledge, of the diffuse states. The advantage of this specification is that the analysis of these states is more objective. That is, the observations, rather than additional distribution assumptions, aid in understanding the diffuse states. The disadvantage is that posterior distributions of the states might be improper, and the likelihood function is unbounded. However, with enough data and an identifiable, Gaussian state-space model, the filtered and smoothed states, and a likelihood based on them, can be computed using the diffuse Kalman filter.
Represent a static, initial state as unknown parameter by attributing to it an infinite variance.
In a time-invariant state-space model:
The coefficient matrices are equivalent for all periods.
The number of states, state disturbances, observations, and observation innovations are the same for all periods.
For example, for all t, the following system of equations
represents a time-invariant state-space model.
In a time-varying state-space model:
The coefficient matrices might change from period to period.
The number of states, state disturbances, observations, and observation innovations might change from period to period. For example, this might happen if there is a regime shift or one of the states or observations cannot be measured during the sampling time frame. Also, you can model seasonality using time-varying models.
To illustrate a regime shift, suppose, for t = 1,..,10
for t = 11
and for t = 12,..,T
There are three sets of state transition matrices, whereas there are only two sets of the other coefficient matrices.
To create a standard or diffuse state-space model, use
dssm, respectively. For time-invariant models,
explicitly specify the parametric form of your state-space model by
supplying the coefficient matrices. For time-variant, complex models,
or models that require constraints, supply a parameter-to-matrix mapping
function. The software can infer the type of state (stationary, the
constant one, or nonstationary), but it is best practice to supply
the state type using, for example, the
To filter and smooth the states of a specified
the software uses the standard Kalman filter or the diffuse Kalman
filter. To implement either, the software requires the parameters
of the initial state distribution (x0).
For stationary states (
the initial means, variances, and covariances are finite, and the
software infers them. However, you can specify other values using
and dot notation.
For states that are the constant one for all periods
1), the initial
state means are 1 and covariances are 0.
For nonstationary or diffuse states (
For standard state-space model, the initial state
means are 0 and initial state variance is
default. To specify an initial state covariance of
dssm model object instead.
For diffuse state-space models, the initial state
means are 0 and initial state variance is
 Durbin J., and S. J. Koopman. Time Series Analysis by State Space Methods. 2nd ed. Oxford: Oxford University Press, 2012.