%% Label Markov Chain States
% Consider the two-state business cycle of the US real gross national product (GNP) in [3] p. 697. At time t, real GNP can be in a state of expansion or contraction. Suppose that the following statements are true during the sample period.
% If real GNP is expanding at time t, then the probability that it will continue in an expansion state at time t + 1 is p_{11} = 0.90.
% If real GNP is contracting at time t, then the probability that it will continue in a contraction state at time t + 1 is p_{22} = 0.75.
% Create the transition matrix for the model.

p11 = 0.90;
p22 = 0.75;

P = [p11 (1 - p11); (1 - p22) p22];

%
% Create the Markov chain that is characterized by the transition matrix P. Label the two states.

mc = dtmc(P,'StateNames',["Expansion" "Contraction"])

%
% Plot a directed graph of the Markov chain. Indicate the probability of transition by using edge colors.

figure;
graphplot(mc,'ColorEdges',true);

% Copyright 2012 The MathWorks, Inc.