Create and Adjust VAR Model Using Shorthand Syntax
This example shows how to create a three-dimensional VAR(4) model with unknown parameters using varm
and the shorthand syntax. Then, this example shows how to adjust parameters of the created model using dot notation.
Create a VAR(4) model for a three-dimensional response series using the shorthand syntax.
numseries = 3; p = 4; Mdl = varm(3,4)
Mdl = varm with properties: Description: "3-Dimensional VAR(4) Model" SeriesNames: "Y1" "Y2" "Y3" NumSeries: 3 P: 4 Constant: [3×1 vector of NaNs] AR: {3×3 matrices of NaNs} at lags [1 2 3 ... and 1 more] Trend: [3×1 vector of zeros] Beta: [3×0 matrix] Covariance: [3×3 matrix of NaNs]
Mdl
is a varm
model object. The properties of the model display at the command line. Observe that:
The default value of some of the parameters are
NaN
values, which indicates their presence in the model. In particular, each lag from 1 through 4 has an unknown, nonzero autoregressive coefficient matrix.You created the model without using response data. That is,
Mdl
is agnostic about data.
Suppose that you want lags 1 and 4 in the model to be unknown and nonzero, but all other lags are zero. Using dot notation, remove the other lags from the model object by placing 3-by-3 matrices of zeros the corresponding cells.
Mdl.AR{2} = zeros(3); Mdl.AR{3} = zeros(3)
Mdl = varm with properties: Description: "3-Dimensional VAR(4) Model" SeriesNames: "Y1" "Y2" "Y3" NumSeries: 3 P: 4 Constant: [3×1 vector of NaNs] AR: {3×3 matrices} at lags [1 4] Trend: [3×1 vector of zeros] Beta: [3×0 matrix] Covariance: [3×3 matrix of NaNs]
Observe that the model degree p
is still 4
, but there are unknown, nonzero coefficients at lags 1 and 4 only.