disp

Class: ssm

Display summary information for state-space models

Syntax

Description

example

disp(Mdl) displays summary information for the state-space model (ssm) Mdl. The display includes the state and observation equations as a system of scalar equations to facilitate model verification. The display also includes the coefficient dimensionalities, notation, and initial state distribution types.

The software displays unknown parameter values using c1 for the first unknown parameter, c2 for the second unknown parameter, and so on.

For time-varying models, if there are more than 20 different sets of equations, then the software displays the first and last 10 groups in terms of time (the last group is the latest).

example

disp(Mdl,params) displays the ssm model Mdl and applies initial values to the model parameters (params).

example

disp(___,Name,Value) displays the ssm model with additional options specified by one or more Name,Value pair arguments. For example, specify the number of digits to display after the decimal point for model coefficients, or the number of terms per row for state and observation equations.

Tips

  • The software always displays explicitly specified state-space models (that is, models you create without using a parameter-to-matrix mapping function). Try explicitly specifying state-space models first so that you can verify them using disp.

  • A parameter-to-matrix function that you specify to create Mdl is a black box to the software. Therefore, the software might not display complex, implicitly defined state-space models.

Input Arguments

expand all

Mdl — State-space modelssm model

State-space model, specified as an ssm model returned by ssm or estimate.

params — Unknown parameter initial values[] (default) | numeric vector

Unknown parameter initial values, specified as a numeric vector.

The elements of params correspond to the unknown parameters in the state-space model matrices A, B, C, and D, and, optionally, the initial state mean Mean0 and covariance matrix Cov0.

  • If you created Mdl explicitly (that is, by specifying the matrices without a parameter-to-matrix mapping function), then the software maps the elements of params to NaNs in the state-space model matrices and initial state values. The software searches for NaNs column-wise following the order A, B, C, D, Mean0, and Cov0.

  • If you created Mdl implicitly (that is, by specifying the matrices with a parameter-to-matrix mapping function), then you must set initial parameter values for the state-space model matrices, initial state values, and state types within the parameter-to-matrices mapping function.

To set the type of initial state distribution, see ssm.

Data Types: double

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

'MaxStateEq' — Maximum number of equations to display100 (default) | positive integer

Maximum number of equations to display, specified as the comma-separated pair consisting of 'MaxStateEq' and a positive integer. If the maximum number of states among all periods is no larger than MaxStateEq, then the software displays the model equation by equation.

Example: 'MaxStateEq',10

Data Types: double

'NumDigits' — Number of digits to display after decimal point2 (default) | nonnegative integer

Number of digits to display after the decimal point for known or estimated model coefficients, specified as the comma-separated pair consisting of 'NumDigits' and a nonnegative integer.

Example: 'NumDigits',0

Data Types: double

'Period' — Period to display state and observation equationspositive integer

Period to display state and observation equations for time-varying, state-space models, specified as the comma-separated pair consisting of 'Period' and a positive integer.

By default, the software displays state and observation equations for all periods.

If Period exceeds the maximum number of observations that the model supports, then the software displays state and observation equations for all periods. If there are more than 20 different sets of equations, then the software displays the first and last 10 groups in terms of time (the last group is the latest).

Example: 'Period',120

Data Types: double

'PredictorsPerRow' — Number of equation terms to display per row5 (default) | positive integer

Number of equation terms to display per row, specified as the comma-separated pair consisting of 'PredictorsPerRow' and a positive integer.

Example: 'PredictorsPerRow',3

Data Types: double

Examples

expand all

Verify an Explicitly Defined State-Space Model

An important step in state-space model analysis is to ensure that the software interpretes the state and observation equation matrices as you intend. Use disp to help you verify the state-space model.

Define a state-space model, where the state equation is an AR(2) model, and the observation equation is the difference between the current and previous state plus the observation error. Symbolically, the state-space model is

$$\left[ {\begin{array}{*{20}{c}}{{x_{1,t}}}\\{{x_{2,t}}}\\{{x_{3,t}}}\end{array}}
\right] = \left[
{\begin{array}{*{20}{c}}0.6&0.2&0.5\\1&0&0\\0&0&1\end{array}} \right]\left[
{\begin{array}{*{20}{c}}{{x_{1,t - 1}}}\\{{x_{2,t - 1}}}\\{{x_{3,t -
1}}}\end{array}} \right] + \left[ {\begin{array}{*{20}{c}}{0.3} \\
0 \\ 0\end{array}} \right]u_{1,t}$$

$${y_t} = \left[ {\begin{array}{*{20}{c}}1&-1&0\end{array}}
\right]\left[
{\begin{array}{*{20}{c}}{{x_{1,t}}}\\{{x_{2,t}}}\\{{x_{3,t}}}\end{array}}
\right]+0.1\varepsilon_t.$$

There are three states: $x_{1,t}$ is the AR(2) process, $x_{2,t}$ represents $x_{1,t-1}$, and $x_{3,t}$ is the AR(2) model constant.

Define the state-transition matrix.

A = [0.6 0.2 0.5; 1 0 0; 0 0 1];

Define the state-disturbance-loading matrix.

B = [0.3; 0; 0];

Define the measurement-sensitivity matrix.

C = [1 -1 0];

Define the observation-innovation matrix.

D = 0.1;

Specify the state-space model using ssm. Set the initial-state mean (Mean0) and covariance matrix (Cov0). Identify the type of initial state distributions (StateType) by noting the following:

  • $x_{1,t}$ is a stationary, AR(2) process.

  • $x_{2,t}$ is also a stationary, AR(2) process.

  • $x_{3,t}$ is the constant 1 for all periods.

Mean0 = [0; 0; 1];                                        % The mean of the AR(2)
varAR2 = 0.3*(1 - 0.2)/((1 + 0.2)*((1 - 0.2)^2 - 0.6^2)); % The variance of the AR(2)
Cov1AR2 = 0.6*0.3/((1 + 0.2)*((1 - 0.2)^2) - 0.6^2);      % The covariance of the AR(2)
Cov0 = zeros(3);
Cov0(1:2,1:2) = varAR2*eye(2) + Cov1AR2*flip(eye(2));
StateType = [0; 0; 1];
Mdl = ssm(A,B,C,D,'Mean0',Mean0,'Cov0',Cov0,'StateType',StateType);

Mdl is an ssm model.

Verify the state-space model using disp.

disp(Mdl)
State vector length: 3
Observation vector length: 1
State disturbance vector length: 1
Observation innovation vector length: 1
Sample size supported by model: Unlimited

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

State equations:
x1(t) = (0.60)x1(t-1) + (0.20)x2(t-1) + (0.50)x3(t-1) + (0.30)u1(t)
x2(t) = x1(t-1)
x3(t) = x3(t-1)

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

Initial state distribution:

Initial state means
 x1  x2  x3 
  0   0   1 

Initial state covariance matrix
     x1    x2    x3 
 x1  0.71  0.44   0 
 x2  0.44  0.71   0 
 x3   0     0     0 

State types
     x1          x2         x3    
 Stationary  Stationary  Constant 

Display a State-Space Model with Initial Values

Define a state-space model containing two independent, autoregressive states, and where the observations are the deterministic sum of the two states. Symbolically, the system of equations is

$$\left[
{\begin{array}{*{20}{c}}{{x_{t,1}}}\\{{x_{t,2}}}\end{array}} \right] =
\left[ {\begin{array}{*{20}{c}}{{\phi _1}}&0\\0&{{\phi _2}}\end{array}}
\right]\left[ {\begin{array}{*{20}{c}}{{x_{t - 1,1}}}\\{{x_{t -
1,2}}}\end{array}} \right] + \left[
{\begin{array}{*{20}{c}}{\sigma_1} & 0\\0 & \sigma_2\end{array}} \right]\left[
{\begin{array}{*{20}{c}}{{u_{t,1}}}\\{{u_{t,2}}}\end{array}}
\right]$$

$${y_t} = \left[ {\begin{array}{*{20}{c}}1&1\end{array}}
\right]\left[
{\begin{array}{*{20}{c}}{{x_{t,1}}}\\{{x_{t,2}}}\end{array}}
\right].$$

Specify the state-transition matrix.

A = [NaN 0; 0 NaN];

Specify the state-disturbance-loading matrix.

B = [NaN 0; 0 NaN];

Specify the measurement-sensitivity matrix.

C = [1 1];

Specify an empty matrix for the observation distrubance matrix.

D = [];

Use ssm to define the state-space model. Specify the initial state means and covariance matrix to as unknown parameters. Specify that the states are stationary.

Mean0 = nan(2,1);
Cov0 = nan(2,2);
StateType = zeros(2,1);
Mdl = ssm(A,B,C,D,'Mean0',Mean0,'Cov0',Cov0,'StateType',StateType);

Mdl is an ssm model containing unknown parameters.

Use disp to display the state-space model. Specify initial values for the unknown parameters and the initial state means and covariance matrix as follows:

  • $\phi_{1,0} = \phi_{2,0} = 0.1$.

  • $\sigma_{1,0} = \sigma_{2,0} = 0.2$.

  • $x_{1,0} = 1$ and $x_{2,0} = 0.5$.

  • $\Sigma_{x_{1,0},x_{2,0}} = I_2$.

params = [0.1; 0.1; 0.2; 0.2; 1; 0.5; 1; 0; 0; 1];
disp(Mdl,params)
State vector length: 2
Observation vector length: 1
State disturbance vector length: 2
Observation innovation vector length: 0
Sample size supported by model: Unlimited
Unknown parameters for estimation: 10

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) + (c3)u1(t)
x2(t) = (c2)x2(t-1) + (c4)u2(t)

Observation equation:
y1(t) = x1(t) + x2(t)

Initial state distribution:

Initial state means
 x1   x2  
  1  0.50 

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

State types
     x1          x2     
 Stationary  Stationary 

Explicitly Specify and Display a Time-Varying State-Space Model

This example shows the behavior of the software when you explicitly specify a time-varying state space model.

From periods 1 through 50, the state model is an AR(2) and an MA(1) model, and the observation model is the sum of the two states. From periods 51 through 100, the state model only includes the first AR(2) model. Symbolically, the state-space model is, from periods 1 through 50,

$$\begin{array}{c}\left[
{\begin{array}{*{20}{c}}{{x_{1t}}}\\{{x_{2t}}}\\{{x_{3t}}}\\{{x_{4t}}}\end{array}}
\right] = \left[ {\begin{array}{*{20}{c}}{{\phi _1}}&{{\phi
_2}}&0&0\\1&0&0&0\\0&0&0&\theta \\0&0&0&0\end{array}} \right]\left[
{\begin{array}{*{20}{c}}{{x_{1,t - 1}}}\\{{x_{2,t - 1}}}\\{{x_{3,t -
1}}}\\{{x_{4,t - 1}}}\end{array}} \right] + \left[
{\begin{array}{*{20}{c}}{{\sigma
_1}}&0&0&0\\0&0&0&0\\0&0&1&{\rm{0}}\\0&0&1&0\end{array}} \right]\left[
{\begin{array}{*{20}{c}}{{u_{1t}}}\\{{u_{2t}}}\\{{u_{3t}}}\\{{u_{4t}}}\end{array}}
\right]\\{y_t} = {a_1}\left( {{x_{1t}} + {x_{3t}}} \right) + {\sigma
_2}{\varepsilon _t}\end{array}$$

for period 51,

$$\begin{array}{c}
\left[ {\begin{array}{*{20}{c}}
{{x_{1t}}}\\
{{x_{2t}}}
\end{array}} \right] = \left[ {\begin{array}{*{20}{c}}
{{\phi _1}}&{{\phi _2}}&0&0\\
1&0&0&0
\end{array}} \right]\left[ {\begin{array}{*{20}{c}}
{{x_{1,t - 1}}}\\
{{x_{2,t - 1}}}\\
{{x_{3,t - 1}}}\\
{{x_{4,t - 1}}}
\end{array}} \right] + \left[ {\begin{array}{*{20}{c}}
{{\sigma _1}}&0&0&0\\
0&0&0&0
\end{array}} \right]\left[ {\begin{array}{*{20}{c}}
{{u_{1t}}}\\
{{u_{2t}}}
\end{array}} \right]\\
{y_t} = {a_2}{x_{1t}} + {\sigma _3}{\varepsilon _t}
\end{array}$$

and for periods 52 through 100,

$$\begin{array}{c}
\left[ {\begin{array}{*{20}{c}}
{{x_{1t}}}\\
{{x_{2t}}}
\end{array}} \right] = \left[ {\begin{array}{*{20}{c}}
{{\phi _1}}&{{\phi _2}}\\
1&0
\end{array}} \right]\left[ {\begin{array}{*{20}{c}}
{{x_{1,t - 1}}}\\
{{x_{2,t - 1}}}
\end{array}} \right] + \left[ {\begin{array}{*{20}{c}}
{{\sigma _1}}&0\\
0&0
\end{array}} \right]\left[ {\begin{array}{*{20}{c}}
{{u_{1t}}}\\
{{u_{2t}}}
\end{array}} \right]\\
{y_t} = {a_2}{x_{1t}} + {\sigma _3}{\varepsilon _t.}
\end{array}$$

Specify the state-transition coefficient matrix.

A1 = {[NaN NaN 0 0; 1 0 0 0; 0 0 0 NaN; 0 0 0 0]};
A2 = {[NaN NaN 0 0; 1 0 0 0]};
A3 = {[NaN NaN; 1 0]};
A = [repmat(A1,50,1);A2;repmat(A3,49,1)];

Specify the state-disturbance-loading coefficient matrix.

B1 = {[NaN 0 0 0; 0 0 0 0; 0 0 1 0; 0 0 1 0]};
B2 = {[NaN 0 0 0; 0 0 0 0]};
B3 = {[NaN 0; 0 0]};
B = [repmat(B1,50,1);B2;repmat(B3,49,1)];

Specify the measurement-sensitivity coefficient matrix.

C1 = {[NaN 0 NaN 0]};
C3 = {[NaN 0]};
C = [repmat(C1,50,1);repmat(C3,50,1)];

Specify an empty matrix for the observation distrubance coefficient matrix.

D1 = {NaN};
D3 = {NaN};
D = [repmat(D1,50,1);repmat(D3,50,1)];

Specify the state-space model. Set the initial state means and covariance matrix to unknown parameters. Specify that the initial state distributions are stationary.

Mean0 = nan(4,1);
Cov0 = nan(4,4);
StateType = [0; 0; 0; 0];

Mdl = ssm(A,B,C,D,'Mean0',Mean0,'Cov0',Cov0,'StateType',StateType);

Mdl is an ssm model.

The model is large and it contains a different set of parameters for each period. The software displays state and observation equations for the first 10 and last 10 periods. You can choose which periods to display the equations for using the 'Period' name-value pair argument.

Display the state-space model, and specify to display the state and observation equations for the 50th, 51st, and 52nd periods.

disp(Mdl,'Period',50)
disp(Mdl,'Period',51)
disp(Mdl,'Period',52)
State vector length: Time-varying
Observation vector length: 1
State disturbance vector length: Time-varying
Observation innovation vector length: 1
Sample size supported by model: 100
Unknown parameters for estimation: 620

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

State equations (in period 50):
x1(t) = (c148)x1(t-1) + (c149)x2(t-1) + (c300)u1(t)
x2(t) = x1(t-1)
x3(t) = (c150)x4(t-1) + u3(t)
x4(t) = u3(t)
Time-varying transition matrix A contains unknown parameters:
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 
c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32 c33 c34 c35 c36 c37 c38 c39 c40 
c41 c42 c43 c44 c45 c46 c47 c48 c49 c50 c51 c52 c53 c54 c55 c56 c57 c58 c59 c60 
c61 c62 c63 c64 c65 c66 c67 c68 c69 c70 c71 c72 c73 c74 c75 c76 c77 c78 c79 c80 
c81 c82 c83 c84 c85 c86 c87 c88 c89 c90 c91 c92 c93 c94 c95 c96 c97 c98 c99 c100 
c101 c102 c103 c104 c105 c106 c107 c108 c109 c110 c111 c112 c113 c114 c115 c116 c117 c118 c119 c120 
c121 c122 c123 c124 c125 c126 c127 c128 c129 c130 c131 c132 c133 c134 c135 c136 c137 c138 c139 c140 
c141 c142 c143 c144 c145 c146 c147 c148 c149 c150 c151 c152 c153 c154 c155 c156 c157 c158 c159 c160 
c161 c162 c163 c164 c165 c166 c167 c168 c169 c170 c171 c172 c173 c174 c175 c176 c177 c178 c179 c180 
c181 c182 c183 c184 c185 c186 c187 c188 c189 c190 c191 c192 c193 c194 c195 c196 c197 c198 c199 c200 
c201 c202 c203 c204 c205 c206 c207 c208 c209 c210 c211 c212 c213 c214 c215 c216 c217 c218 c219 c220 
c221 c222 c223 c224 c225 c226 c227 c228 c229 c230 c231 c232 c233 c234 c235 c236 c237 c238 c239 c240 
c241 c242 c243 c244 c245 c246 c247 c248 c249 c250 
Time-varying state disturbance loading matrix B contains unknown parameters:
c251 c252 c253 c254 c255 c256 c257 c258 c259 c260 c261 c262 c263 c264 c265 c266 c267 c268 c269 c270 
c271 c272 c273 c274 c275 c276 c277 c278 c279 c280 c281 c282 c283 c284 c285 c286 c287 c288 c289 c290 
c291 c292 c293 c294 c295 c296 c297 c298 c299 c300 c301 c302 c303 c304 c305 c306 c307 c308 c309 c310 
c311 c312 c313 c314 c315 c316 c317 c318 c319 c320 c321 c322 c323 c324 c325 c326 c327 c328 c329 c330 
c331 c332 c333 c334 c335 c336 c337 c338 c339 c340 c341 c342 c343 c344 c345 c346 c347 c348 c349 c350 

Observation equation (in period 50):
y1(t) = (c449)x1(t) + (c450)x3(t) + (c550)e1(t)
Time-varying measurement sensitivity matrix C contains unknown parameters:
c351 c352 c353 c354 c355 c356 c357 c358 c359 c360 c361 c362 c363 c364 c365 c366 c367 c368 c369 c370 
c371 c372 c373 c374 c375 c376 c377 c378 c379 c380 c381 c382 c383 c384 c385 c386 c387 c388 c389 c390 
c391 c392 c393 c394 c395 c396 c397 c398 c399 c400 c401 c402 c403 c404 c405 c406 c407 c408 c409 c410 
c411 c412 c413 c414 c415 c416 c417 c418 c419 c420 c421 c422 c423 c424 c425 c426 c427 c428 c429 c430 
c431 c432 c433 c434 c435 c436 c437 c438 c439 c440 c441 c442 c443 c444 c445 c446 c447 c448 c449 c450 
c451 c452 c453 c454 c455 c456 c457 c458 c459 c460 c461 c462 c463 c464 c465 c466 c467 c468 c469 c470 
c471 c472 c473 c474 c475 c476 c477 c478 c479 c480 c481 c482 c483 c484 c485 c486 c487 c488 c489 c490 
c491 c492 c493 c494 c495 c496 c497 c498 c499 c500 
Time-varying observation innovation loading matrix D contains unknown parameters:
c501 c502 c503 c504 c505 c506 c507 c508 c509 c510 c511 c512 c513 c514 c515 c516 c517 c518 c519 c520 
c521 c522 c523 c524 c525 c526 c527 c528 c529 c530 c531 c532 c533 c534 c535 c536 c537 c538 c539 c540 
c541 c542 c543 c544 c545 c546 c547 c548 c549 c550 c551 c552 c553 c554 c555 c556 c557 c558 c559 c560 
c561 c562 c563 c564 c565 c566 c567 c568 c569 c570 c571 c572 c573 c574 c575 c576 c577 c578 c579 c580 
c581 c582 c583 c584 c585 c586 c587 c588 c589 c590 c591 c592 c593 c594 c595 c596 c597 c598 c599 c600 

Initial state distribution:

Initial state means
  x1   x2   x3   x4 
 NaN  NaN  NaN  NaN 

Initial state covariance matrix
     x1   x2   x3   x4  
 x1  NaN  NaN  NaN  NaN 
 x2  NaN  NaN  NaN  NaN 
 x3  NaN  NaN  NaN  NaN 
 x4  NaN  NaN  NaN  NaN 

State types
     x1          x2          x3          x4     
 Stationary  Stationary  Stationary  Stationary 


State vector length: Time-varying
Observation vector length: 1
State disturbance vector length: Time-varying
Observation innovation vector length: 1
Sample size supported by model: 100
Unknown parameters for estimation: 620

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

State equations (in period 51):
x1(t) = (c151)x1(t-1) + (c152)x2(t-1) + (c301)u1(t)
x2(t) = x1(t-1)
Time-varying transition matrix A contains unknown parameters:
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 
c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32 c33 c34 c35 c36 c37 c38 c39 c40 
c41 c42 c43 c44 c45 c46 c47 c48 c49 c50 c51 c52 c53 c54 c55 c56 c57 c58 c59 c60 
c61 c62 c63 c64 c65 c66 c67 c68 c69 c70 c71 c72 c73 c74 c75 c76 c77 c78 c79 c80 
c81 c82 c83 c84 c85 c86 c87 c88 c89 c90 c91 c92 c93 c94 c95 c96 c97 c98 c99 c100 
c101 c102 c103 c104 c105 c106 c107 c108 c109 c110 c111 c112 c113 c114 c115 c116 c117 c118 c119 c120 
c121 c122 c123 c124 c125 c126 c127 c128 c129 c130 c131 c132 c133 c134 c135 c136 c137 c138 c139 c140 
c141 c142 c143 c144 c145 c146 c147 c148 c149 c150 c151 c152 c153 c154 c155 c156 c157 c158 c159 c160 
c161 c162 c163 c164 c165 c166 c167 c168 c169 c170 c171 c172 c173 c174 c175 c176 c177 c178 c179 c180 
c181 c182 c183 c184 c185 c186 c187 c188 c189 c190 c191 c192 c193 c194 c195 c196 c197 c198 c199 c200 
c201 c202 c203 c204 c205 c206 c207 c208 c209 c210 c211 c212 c213 c214 c215 c216 c217 c218 c219 c220 
c221 c222 c223 c224 c225 c226 c227 c228 c229 c230 c231 c232 c233 c234 c235 c236 c237 c238 c239 c240 
c241 c242 c243 c244 c245 c246 c247 c248 c249 c250 
Time-varying state disturbance loading matrix B contains unknown parameters:
c251 c252 c253 c254 c255 c256 c257 c258 c259 c260 c261 c262 c263 c264 c265 c266 c267 c268 c269 c270 
c271 c272 c273 c274 c275 c276 c277 c278 c279 c280 c281 c282 c283 c284 c285 c286 c287 c288 c289 c290 
c291 c292 c293 c294 c295 c296 c297 c298 c299 c300 c301 c302 c303 c304 c305 c306 c307 c308 c309 c310 
c311 c312 c313 c314 c315 c316 c317 c318 c319 c320 c321 c322 c323 c324 c325 c326 c327 c328 c329 c330 
c331 c332 c333 c334 c335 c336 c337 c338 c339 c340 c341 c342 c343 c344 c345 c346 c347 c348 c349 c350 

Observation equation (in period 51):
y1(t) = (c451)x1(t) + (c551)e1(t)
Time-varying measurement sensitivity matrix C contains unknown parameters:
c351 c352 c353 c354 c355 c356 c357 c358 c359 c360 c361 c362 c363 c364 c365 c366 c367 c368 c369 c370 
c371 c372 c373 c374 c375 c376 c377 c378 c379 c380 c381 c382 c383 c384 c385 c386 c387 c388 c389 c390 
c391 c392 c393 c394 c395 c396 c397 c398 c399 c400 c401 c402 c403 c404 c405 c406 c407 c408 c409 c410 
c411 c412 c413 c414 c415 c416 c417 c418 c419 c420 c421 c422 c423 c424 c425 c426 c427 c428 c429 c430 
c431 c432 c433 c434 c435 c436 c437 c438 c439 c440 c441 c442 c443 c444 c445 c446 c447 c448 c449 c450 
c451 c452 c453 c454 c455 c456 c457 c458 c459 c460 c461 c462 c463 c464 c465 c466 c467 c468 c469 c470 
c471 c472 c473 c474 c475 c476 c477 c478 c479 c480 c481 c482 c483 c484 c485 c486 c487 c488 c489 c490 
c491 c492 c493 c494 c495 c496 c497 c498 c499 c500 
Time-varying observation innovation loading matrix D contains unknown parameters:
c501 c502 c503 c504 c505 c506 c507 c508 c509 c510 c511 c512 c513 c514 c515 c516 c517 c518 c519 c520 
c521 c522 c523 c524 c525 c526 c527 c528 c529 c530 c531 c532 c533 c534 c535 c536 c537 c538 c539 c540 
c541 c542 c543 c544 c545 c546 c547 c548 c549 c550 c551 c552 c553 c554 c555 c556 c557 c558 c559 c560 
c561 c562 c563 c564 c565 c566 c567 c568 c569 c570 c571 c572 c573 c574 c575 c576 c577 c578 c579 c580 
c581 c582 c583 c584 c585 c586 c587 c588 c589 c590 c591 c592 c593 c594 c595 c596 c597 c598 c599 c600 

Initial state distribution:

Initial state means
  x1   x2   x3   x4 
 NaN  NaN  NaN  NaN 

Initial state covariance matrix
     x1   x2   x3   x4  
 x1  NaN  NaN  NaN  NaN 
 x2  NaN  NaN  NaN  NaN 
 x3  NaN  NaN  NaN  NaN 
 x4  NaN  NaN  NaN  NaN 

State types
     x1          x2          x3          x4     
 Stationary  Stationary  Stationary  Stationary 


State vector length: Time-varying
Observation vector length: 1
State disturbance vector length: Time-varying
Observation innovation vector length: 1
Sample size supported by model: 100
Unknown parameters for estimation: 620

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

State equations (in period 52):
x1(t) = (c153)x1(t-1) + (c154)x2(t-1) + (c302)u1(t)
x2(t) = x1(t-1)
Time-varying transition matrix A contains unknown parameters:
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 
c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32 c33 c34 c35 c36 c37 c38 c39 c40 
c41 c42 c43 c44 c45 c46 c47 c48 c49 c50 c51 c52 c53 c54 c55 c56 c57 c58 c59 c60 
c61 c62 c63 c64 c65 c66 c67 c68 c69 c70 c71 c72 c73 c74 c75 c76 c77 c78 c79 c80 
c81 c82 c83 c84 c85 c86 c87 c88 c89 c90 c91 c92 c93 c94 c95 c96 c97 c98 c99 c100 
c101 c102 c103 c104 c105 c106 c107 c108 c109 c110 c111 c112 c113 c114 c115 c116 c117 c118 c119 c120 
c121 c122 c123 c124 c125 c126 c127 c128 c129 c130 c131 c132 c133 c134 c135 c136 c137 c138 c139 c140 
c141 c142 c143 c144 c145 c146 c147 c148 c149 c150 c151 c152 c153 c154 c155 c156 c157 c158 c159 c160 
c161 c162 c163 c164 c165 c166 c167 c168 c169 c170 c171 c172 c173 c174 c175 c176 c177 c178 c179 c180 
c181 c182 c183 c184 c185 c186 c187 c188 c189 c190 c191 c192 c193 c194 c195 c196 c197 c198 c199 c200 
c201 c202 c203 c204 c205 c206 c207 c208 c209 c210 c211 c212 c213 c214 c215 c216 c217 c218 c219 c220 
c221 c222 c223 c224 c225 c226 c227 c228 c229 c230 c231 c232 c233 c234 c235 c236 c237 c238 c239 c240 
c241 c242 c243 c244 c245 c246 c247 c248 c249 c250 
Time-varying state disturbance loading matrix B contains unknown parameters:
c251 c252 c253 c254 c255 c256 c257 c258 c259 c260 c261 c262 c263 c264 c265 c266 c267 c268 c269 c270 
c271 c272 c273 c274 c275 c276 c277 c278 c279 c280 c281 c282 c283 c284 c285 c286 c287 c288 c289 c290 
c291 c292 c293 c294 c295 c296 c297 c298 c299 c300 c301 c302 c303 c304 c305 c306 c307 c308 c309 c310 
c311 c312 c313 c314 c315 c316 c317 c318 c319 c320 c321 c322 c323 c324 c325 c326 c327 c328 c329 c330 
c331 c332 c333 c334 c335 c336 c337 c338 c339 c340 c341 c342 c343 c344 c345 c346 c347 c348 c349 c350 

Observation equation (in period 52):
y1(t) = (c452)x1(t) + (c552)e1(t)
Time-varying measurement sensitivity matrix C contains unknown parameters:
c351 c352 c353 c354 c355 c356 c357 c358 c359 c360 c361 c362 c363 c364 c365 c366 c367 c368 c369 c370 
c371 c372 c373 c374 c375 c376 c377 c378 c379 c380 c381 c382 c383 c384 c385 c386 c387 c388 c389 c390 
c391 c392 c393 c394 c395 c396 c397 c398 c399 c400 c401 c402 c403 c404 c405 c406 c407 c408 c409 c410 
c411 c412 c413 c414 c415 c416 c417 c418 c419 c420 c421 c422 c423 c424 c425 c426 c427 c428 c429 c430 
c431 c432 c433 c434 c435 c436 c437 c438 c439 c440 c441 c442 c443 c444 c445 c446 c447 c448 c449 c450 
c451 c452 c453 c454 c455 c456 c457 c458 c459 c460 c461 c462 c463 c464 c465 c466 c467 c468 c469 c470 
c471 c472 c473 c474 c475 c476 c477 c478 c479 c480 c481 c482 c483 c484 c485 c486 c487 c488 c489 c490 
c491 c492 c493 c494 c495 c496 c497 c498 c499 c500 
Time-varying observation innovation loading matrix D contains unknown parameters:
c501 c502 c503 c504 c505 c506 c507 c508 c509 c510 c511 c512 c513 c514 c515 c516 c517 c518 c519 c520 
c521 c522 c523 c524 c525 c526 c527 c528 c529 c530 c531 c532 c533 c534 c535 c536 c537 c538 c539 c540 
c541 c542 c543 c544 c545 c546 c547 c548 c549 c550 c551 c552 c553 c554 c555 c556 c557 c558 c559 c560 
c561 c562 c563 c564 c565 c566 c567 c568 c569 c570 c571 c572 c573 c574 c575 c576 c577 c578 c579 c580 
c581 c582 c583 c584 c585 c586 c587 c588 c589 c590 c591 c592 c593 c594 c595 c596 c597 c598 c599 c600 

Initial state distribution:

Initial state means
  x1   x2   x3   x4 
 NaN  NaN  NaN  NaN 

Initial state covariance matrix
     x1   x2   x3   x4  
 x1  NaN  NaN  NaN  NaN 
 x2  NaN  NaN  NaN  NaN 
 x3  NaN  NaN  NaN  NaN 
 x4  NaN  NaN  NaN  NaN 

State types
     x1          x2          x3          x4     
 Stationary  Stationary  Stationary  Stationary 

The software attributes a different set of coefficients for each period. You might experience numerical issues when you estimate such models. To reuse parameters among groups of periods, consider creating a parameter-to-matrix mapping function.

Display a State-Space Model with a Random Coefficient

Use a parameter map to specify a time-variant, state-space model containing a random coefficient.

Create the function randomCoeffParamMap.m, which specifies how the parameters in params map to the state-space model matrices. Symbolically, the model is

[x1,tx2,t]=[100ϕ][x1,t1x2,t1]+[100σ][u1,tu2,t]yt=[11][x1,tx2,t]+εt,

where ϕ is a random coefficient.

function [A,B,C,D] = randomCoeffParamMap(c)
% State-space model parameter-to-matrix mapping function with a random
% coefficient example.  There are two states: one is a random walk with
% disturbance variance 1, and the other is a first-order Markov model with
% a random coefficient and an unknown variance.  The observation equation
% is the sum of the two states, and the innovation has variance 1.
A = diag([1,c(1)*rand]);
B = [1 0; 0 c(2)];
C = [1,1];
D = 1;
end

Specify the state-space model by passing randomCoeffParamMap as a function handle to ssm.

Mdl = ssm(@randomCoeffParamMap);

The software implicitly specifies the ssm model Mdl.

Display Mdl using disp. Specify initial parameters values.

disp(Mdl,[3; 5])
State vector length: 2
Observation vector length: 1
State disturbance vector length: 2
Observation innovation vector length: 1
Sample size supported by model: Unlimited

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

State equations:
x1(t) = x1(t-1) + u1(t)
x2(t) = (2.06)x2(t-1) + (5)u2(t)

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

Initial state distribution:

Initial state means
 x1  x2 
  0   0 

Initial state covariance matrix
     x1     x2    
 x1  1e+07  0     
 x2  0      1e+07 

State types
    x1       x2   
 Diffuse  Diffuse 

The software sets the parameters to their initial values, or functions of their initial values. In this case, the first parameter is the initial values times a random number.

Definitions

State-Space Model

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, Gaussian state-space model using the following system of equations

xt=Atxt1+BtutytZtβ=Ctxt+Dtεt,

for t = 1,...,T.

  • xt=[xt1,...,xtmt] is an mt-dimensional state vector describing the dynamics of some, possibly unobservable, phenomenon at period t.

  • yt=[yt1,...,ytnt] 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.

  • ut=[ut1,...,utkt] is a kt-dimensional, Gaussian, white-noise, unit-variance vector of state disturbances at period t.

  • εt=[εt1,...,εtht] is an ht-dimensional, Gaussian, white-noise, unit-variance vector of observation innovations at period t.

  • εt and ut are uncorrelated.

  • For time-invariant models,

    • Zt=[zt1zt2ztd] 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.

Algorithms

  • If you implicitly created Mdl using ssm, and if the software cannot infer locations for unknown parameters from the parameter-to-matrix function, then the software evaluates these parameters using their initial values and displays them as numerical values. For example, this happens when, for example, there is a random, unknown coefficient in the parameter-to-matrix function, which is a convenient form for a Monte Carlo study.

  • The software always displays the initial state distributions as numerical values because, in many cases, the initial distribution depends on the values of the state equation matrices A and B, which might be a complicated function of unknown parameters. In such situations, the software does not display the initial distribution symbolically, and, if Mean0 and Cov0 contain unknown parameters, then the software evaluates and displays numerical values for the unknown parameters.

References

[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?