%% Create Partially Specified Multivariate Model for Estimation
% Consider fitting to data a three-state Markov-switching model for a 2-D response process.
% Create a discrete-time Markov chain model for the switching mechanism. Specify a 3-by-3 matrix of NaN values for the transition matrix. This setting indicates that you want to estimate all transition probabilities.

P = nan(3);
mc = dtmc(P);

% mc is a partially specified dtmc object. The transition matrix mc.P is completely unknown and estimable.
% Create 2-D VAR(0), VAR(1), and VAR(2) models by using the shorthand syntax of varm. Store the models in a vector.

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

mdl = [mdl1 mdl2 mdl3];
mdl(1)

% mdl contains three state-specific varm model templates for estimation. NaN values in the properties indicate estimable parameters.
% Create a Markov-switching model template from the switching mechanism mc and the state-specific submodels mdl.

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

% Mdl is a partially specified msVAR model for estimation.
% Copyright 2019 The MathWorks, Inc.