%% Create Partially Specified Univariate Model Containing Regression Components
% This example shows how to include an unknown regression component in each submodel of the Markov-switching dynamic regression model  in docid:econ_ug.mw_48d09bd7-279d-4681-82ba-87b6f1016bc3.
% Consider adjusting the response variable with exogenous variables x_{1t} and x_{2t} by including a regression component in each submodel.
% Create a discrete-time Markov chain representing the switching mechanism.

P = NaN(2);
mc = dtmc(P,'StateNames',["Expansion" "Recession"]);

%
% Create the ARX(1) and ARX(2) submodels by using the longhand syntax of arima. For each model, supply a 2-by-1 vector of NaNs to the 'Beta' name-value pair argument. This setting specifies the size of the regression component (that is, which predictors are included) and that it is estimable. Store the submodels in a vector.

mdl1 = arima('ARLags',1,'Beta',NaN(2,1),...
    'Description',"Expansion State");
mdl2 = arima('ARLags',1:2,'Beta',NaN(2,1),...
    'Description',"Recession State");
mdl = [mdl1; mdl2];

%
% Create a Markov-switching dynamic regression model.

Mdl = msVAR(mc,mdl);
Mdl.Submodels(1)
Mdl.Submodels(2)

% Copyright 2019 The MathWorks, Inc.