%% Create Fully Specified Model for US GDP Rate
% Consider a two-state Markov-switching dynamic regression model of the postwar US real GDP growth rate. The model has the parameter estimates presented in docid:econ_ug#shared-bib_chauvet2006.
%
% Create a discrete-time Markov chain model that describes the regime  switching mechanism. Label the regimes.

P = [0.92 0.08; 0.26 0.74];
mc = dtmc(P,'StateNames',["Expansion" "Recession"]);

% mc is a fully specified dtmc object.
%
% Create separate AR(0) models (constant only) for the two regimes.

sigma = 3.34; % Homoscedastic models across states
mdl1 = arima('Constant',4.62,'Variance',sigma^2);
mdl2 = arima('Constant',-0.48,'Variance',sigma^2);
mdl = [mdl1 mdl2];

%
% Create the Markov-switching dynamic regression model that describes the behavior of the US GDP growth rate.

Mdl = msVAR(mc,mdl)

% Mdl is a fully specified msVAR object.
% Copyright 2019 The MathWorks, Inc.