%% Create Model Specifying Equality Constraints for Estimation
% Consider the model in Create Partially Specified Multivariate Model for Estimation. Suppose theory dictates that states do not persist.
% Create a discrete-time Markov chain model for the switching mechanism. Specify a 3-by-3 matrix of NaN values for the transition matrix. Indicate that states do not persist by setting the diagonal elements of the matrix to 0.

P = nan(3);
P(logical(eye(3))) = 0;
mc = dtmc(P);

% mc is a partially specified dtmc object.
% Create the submodels and store them in a vector.

mdl1 = varm(2,0);
mdl2 = varm(2,1);
mdl3 = varm(2,2);
submdl = [mdl1; mdl2; mdl3];

% Create a Markov-switching dynamic regression model from the switching mechanism mc and the state-specific submodels mdl.

Mdl = msVAR(mc,submdl);
Mdl.Switch.P

% estimate treats the known diagonal elements of the transition matrix as equality constraints during estimation.  For more details, see estimate.
% Copyright 2019 The MathWorks, Inc.
%