Modify msVAR Model Specifications
The properties of an msVAR object are read-only. Therefore, to adjust the specification of a created model, you must create a new model. This example shows how to specify known parameter values of a created, partially specified model.
Suppose that is a univariate response process representing an economic measurement that can suggest which state the economy experiences during a period (expansion or recession). During an expansion, is this AR(2) model. During a recession, is an AR(1) model. State-specific submodel coefficients and innovations variances are unknown.
Create a partially specified, univariate, two-state Markov-switching model. (For more details, see Create Partially Specified Univariate Model for Estimation.)
% Switching mechanism P = NaN(2); mc = dtmc(P,StateNames=["Expansion" "Recession"]); % AR submodels mdl1 = arima(1,0,0); mdl1.Description = "Expansion State"; mdl2 = arima(2,0,0); mdl2.Description = "Recession State"; mdl = [mdl1; mdl2]; % Markov-switching model Mdl = msVAR(mc,mdl);
Suppose economic theory suggests:
An expansion persists into the next time step with probability 0.9.
During an expansion, the model constant is 5.
During a recession, the model constant is –5.
Create a new msVAR model based on economic theory by following these steps:
Create a new
dtmcobject containing a transition matrix with the known transition probability.Adjust the
Constantproperty ofmdl1andmdl2by using dot notation.Pass the new
dtmcobject and vector of adjustedarimaobjects tomsVAR.
P(1,1) = 0.9; mc = dtmc(P,StateNames=["Expansion" "Recession"]); mdl1.Constant = 5; mdl2.Constant = -5; mdl = [mdl1; mdl2]; MdlAdj = msVAR(mc,mdl); MdlAdj.Switch.P
ans = 2×2
0.9000 NaN
NaN NaN
MdlAdj.Submodels(1)
ans =
varm with properties:
Description: "1-Dimensional VAR(1) Model"
SeriesNames: "Y1"
NumSeries: 1
P: 1
Constant: 5
AR: {NaN} at lag [1]
Trend: 0
Beta: [1×0 matrix]
Covariance: NaN
MdlAdj.Submodels(2)
ans =
varm with properties:
Description: "1-Dimensional VAR(2) Model"
SeriesNames: "Y1"
NumSeries: 1
P: 2
Constant: -5
AR: {NaN NaN} at lags [1 2]
Trend: 0
Beta: [1×0 matrix]
Covariance: NaN
Mdl is a partially specified msVAR model. During estimation, estimate treats the model constants and known transition probability as equality constraints.