Create and Adjust VAR Model Using Longhand Syntax
This example shows how to create a three-dimensional VAR(4) model with unknown parameters using varm
and the longhand 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. Specify that there are unknown coefficient matrices at lags 1 and 4 only.
numseries = 3; p = 4; ar = {nan(3) nan(3)}; lags = [1 p]; Mdl = varm('AR',ar,'Lags',lags)
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]
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.You created the model without using response data. That is,
Mdl
is agnostic about data.
Suppose that you want to add a linear time trend to the model to be estimated. By default, the linear time trend is zero. To make an unknown time trend present in the model, set the Trend
property to a 3-by-1 vector of NaN
values using dot notation.
Mdl.Trend = nan(3,1)
Mdl = varm with properties: Description: "3-Dimensional VAR(4) Model with Linear Time Trend" 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 NaNs] Beta: [3×0 matrix] Covariance: [3×3 matrix of NaNs]