Note: This page has been translated by MathWorks. Click here to see

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

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

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

$$\begin{array}{l}{x}_{t}={A}_{t}{x}_{t-1}+{B}_{t}{u}_{t}\\ {y}_{t}-{\left({Z}_{t}\beta \right)}^{\prime}={C}_{t}{x}_{t}+{D}_{t}{\epsilon}_{t},\end{array}$$

for *t* = 1,...,*T*.

$${x}_{t}=\left[{x}_{t1},\mathrm{...},{x}_{t{m}_{t}}\right]\prime $$ is an

*m*-dimensional state vector describing the dynamics of some, possibly unobservable, phenomenon at period_{t}*t*. The initial state distribution (*x*_{0}) is Gaussian with mean*μ*_{0}and covariance matrix*Σ*_{0}.$${y}_{t}=\left[{y}_{t1},\mathrm{...},{y}_{t{n}_{t}}\right]\prime $$ is an

*n*-dimensional observation vector describing how the states are measured by observers at period_{t}*t*.*A*is the_{t}*m*-by-_{t}*m*_{t – 1}state-transition matrix describing how the states at time*t*transition to the states at period*t*– 1.*B*is the_{t}*m*-by-_{t}*k*state-disturbance-loading matrix describing how the states at period_{t}*t*combine with the innovations at period*t*.*C*is the_{t}*n*-by-_{t}*m*measurement-sensitivity matrix describing how the observations at period_{t}*t*relate to the states at period*t*.*D*is the_{t}*n*-by-_{t}*h*observation-innovation matrix describing how the observations at period_{t}*t*combine with the observation errors at period*t*.The matrices

*A*,_{t}*B*,_{t}*C*, and_{t}*D*are referred to as_{t}*coefficient matrices*, and might contain unknown parameters.$${u}_{t}=\left[{u}_{t1},\mathrm{...},{u}_{t{k}_{t}}\right]\prime $$ is a

*k*-dimensional, Gaussian, white-noise, unit-variance vector of state disturbances at period_{t}*t*.$${\epsilon}_{t}=\left[{\epsilon}_{t1},\mathrm{...},{\epsilon}_{t{h}_{t}}\right]\prime $$ is an

*h*-dimensional, Gaussian, white-noise, unit-variance vector of observation innovations at period_{t}*t*.*ε*and_{t}*u*are uncorrelated._{t}For time-invariant state-space models,

$${Z}_{t}=\left[\begin{array}{cccc}{z}_{t1}& {z}_{t2}& \cdots & {z}_{td}\end{array}\right]$$ 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*Z*._{t}

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

$$\begin{array}{c}\left[\begin{array}{c}{x}_{1,t}\\ {x}_{2,t}\end{array}\right]=\left[\begin{array}{cc}{\varphi}_{1}& 0\\ 0& {\varphi}_{2}\end{array}\right]\left[\begin{array}{c}{x}_{1,t-1}\\ {x}_{2,t-1}\end{array}\right]+\left[\begin{array}{cc}0.5& 0\\ 0& 2\end{array}\right]\left[\begin{array}{c}{u}_{1,t}\\ {u}_{2,t}\end{array}\right]\\ {y}_{t}=\left[\begin{array}{cc}{\varphi}_{3}& 1\end{array}\right]\left[\begin{array}{c}{x}_{1,t}\\ {x}_{2,t}\end{array}\right]+0.2{\epsilon}_{t}\end{array}$$

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

$$\begin{array}{c}\left[\begin{array}{c}{x}_{1,t}\\ {x}_{2,t}\end{array}\right]=\left[\begin{array}{cc}{\varphi}_{1}& 0\\ 0& {\varphi}_{2}\end{array}\right]\left[\begin{array}{c}{x}_{1,t-1}\\ {x}_{2,t-1}\end{array}\right]+\left[\begin{array}{cc}0.5& 0\\ 0& 2\end{array}\right]\left[\begin{array}{c}{u}_{1,t}\\ {u}_{2,t}\end{array}\right]\\ {y}_{t}=\left[\begin{array}{cc}{\varphi}_{3}& 1\end{array}\right]\left[\begin{array}{c}{x}_{1,t}\\ {x}_{2,t}\end{array}\right]+0.2{\epsilon}_{t}\end{array},$$

for *t* = 11

$$\begin{array}{c}{x}_{1,t}=\left[\begin{array}{cc}{\varphi}_{4}& 0\end{array}\right]\left[\begin{array}{c}{x}_{1,t-1}\\ {x}_{2,t-1}\end{array}\right]+0.5{u}_{1,t}\\ {y}_{t}={\varphi}_{5}{x}_{1,t}+0.2{\epsilon}_{t}\end{array},$$

and for *t* = 12,..,*T*

$$\begin{array}{c}{x}_{1,t}={\varphi}_{4}+0.5{u}_{1,t}\\ {y}_{t}={\varphi}_{5}{x}_{1,t}+0.2{\epsilon}_{t}\end{array}.$$

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 `ssm`

or `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 `StateType`

name-value
pair argument.

To filter and smooth the states of a specified `ssm`

or `dssm`

model,
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 (*x*_{0}).

For stationary states (

`StateType`

is`0`

), the initial means, variances, and covariances are finite, and the software infers them. However, you can specify other values using the properties`Mean0`

and`Cov0`

, and dot notation.For states that are the constant one for all periods (

`StateType`

is`1`

), the initial state means are 1 and covariances are 0.For nonstationary or diffuse states (

`StateType`

is`2`

):For standard state-space model, the initial state means are 0 and initial state variance is

`1e7`

by default. To specify an initial state covariance of`Inf`

, create a`dssm`

model object instead.For diffuse state-space models, the initial state means are 0 and initial state variance is

`Inf`

.

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

`dssm`

| `estimate`

| `estimate`

| `filter`

| `filter`

| `forecast`

| `forecast`

| `smooth`

| `smooth`

| `ssm`

- Explicitly Create State-Space Model Containing Known Parameter Values
- Create State-Space Model with Unknown Parameters
- Create State-Space Model Containing ARMA State
- Implicitly Create State-Space Model Containing Regression Component
- Implicitly Create Time-Varying State-Space Model