Main Content

Create State-Space Model Containing ARMA State

This example shows how to create a stationary ARMA model subject to measurement error using ssm.

To explicitly create a state-space model, it is helpful to write the state and observation equations in matrix form. In this example, the state of interest is the ARMA(2,1) process

xt=c+ϕ1xt-1+ϕ2xt-2+ut+θ1ut-1,

where ut is Gaussian with mean 0 and known standard deviation 0.5.

The variables xt, xt-1, and ut are in the state-space model framework. Therefore, the terms c, ϕ2xt-2, and θ1ut-1 require "dummy states" to be included in the model.

The state equation is

[x1,tx2,tx3,tx4,t]=[ϕ1cϕ2θ1010010000000][x1,t-1x2,t-1x3,t-1x4,t-1]+[0.5001]u1,t

Note that:

  • c corresponds to a state (x2,t) that is always 1.

  • x3,t=x1,t-1, and x1,t has the term ϕ2x3,t-1=ϕ2x1,t-2.

  • x1,t has the term 0.5u1,t. ssm puts state disturbances as Gaussian random variables with mean 0 and variance 1. Therefore, the factor 0.5 is the standard deviation of the state disturbance.

  • x4,t=u1,t, and x1,t has the term θ1x4,t=θ1u1,t-1.

The observation equation is unbiased for the ARMA(2,1) state process. The observation innovations are Gaussian with mean 0 and known standard deviation 0.1. Symbolically, the observation equation is

yt=[1000][x1,tx2,tx3,tx4,t]+0.1εt.

You can include a measurement-sensitivity factor (a bias) by replacing 1 in the row vector by a scalar or unknown parameter.

Define the state-transition coefficient matrix. Use NaN values to indicate unknown parameters.

A = [NaN NaN NaN NaN; 0 1 0 0; 1 0 0 0; 0 0 0 0];

Define the state-disturbance-loading coefficient matrix.

B = [0.5; 0; 0; 1];

Define the measurement-sensitivity coefficient matrix.

C = [1 0 0 0];

Define the observation-innovation coefficient matrix.

D = 0.1;

Use ssm to create the state-space model. Set the initial-state mean (Mean0) to a vector of zeros and covariance matrix (Cov0) to the identity matrix, except set the mean and variance of the constant state to 1 and 0, respectively. Specify the type of initial state distributions (StateType) by noting that:

  • x1,t is a stationary, ARMA(2,1) process.

  • x2,t is the constant 1 for all periods.

  • x3,t is the lagged ARMA process, so it is stationary.

  • x4,t is a white-noise process, so it is stationary.

Mean0 = [0; 1; 0; 0];                                      
Cov0 = eye(4);
Cov0(2,2) = 0;
StateType = [0; 1; 0; 0];
Mdl = ssm(A,B,C,D,'Mean0',Mean0,'Cov0',Cov0,'StateType',StateType);

Mdl is an ssm model. You can use dot notation to access its properties. For example, print A by entering Mdl.A.

Use disp to verify the state-space model.

disp(Mdl)
State-space model type: ssm

State vector length: 4
Observation vector length: 1
State disturbance vector length: 1
Observation innovation vector length: 1
Sample size supported by model: Unlimited
Unknown parameters for estimation: 4

State variables: x1, x2,...
State disturbances: u1, u2,...
Observation series: y1, y2,...
Observation innovations: e1, e2,...
Unknown parameters: c1, c2,...

State equations:
x1(t) = (c1)x1(t-1) + (c2)x2(t-1) + (c3)x3(t-1) + (c4)x4(t-1) + (0.50)u1(t)
x2(t) = x2(t-1)
x3(t) = x1(t-1)
x4(t) = u1(t)

Observation equation:
y1(t) = x1(t) + (0.10)e1(t)

Initial state distribution:

Initial state means
 x1  x2  x3  x4 
  0   1   0   0 

Initial state covariance matrix
     x1  x2  x3  x4 
 x1   1   0   0   0 
 x2   0   0   0   0 
 x3   0   0   1   0 
 x4   0   0   0   1 

State types
     x1         x2         x3          x4     
 Stationary  Constant  Stationary  Stationary 

If you have a set of responses, you can pass them and Mdl to estimate to estimate the parameters.

See Also

| |

Related Examples

More About