simulate an artifical MS-VAR process
y_artificial=msvar_draw(T,nb_endo,nlag,nb_states,switching_V,typemod,y0,trans_prob,Const,CMatrix,sigma)
* T = a scalar, the # of observations
* nb_endo = a scalar, the number of endogenous variables
* nlag = a scalar, the number of lags in the VAR
* nb_states = a scalar, the number of states
* switching_V = a scalar, either 1 or the # of states, depending on whether the variance matrix switches or not
* typemod = either 'const' ('cte') or 'all', depending on whether the VAR model should have only the constant or all coefficients in the VAR switch
* y0 = a (nlags x nb_endo) vector of starting values for the endogenous variables in the VAR
* trans_prob = a (nb_states x nb_states) matrix of transition probabilities
* Const = a (nb_endo x nb_states) matrix of constant coefficients
* Cmatrix = either a (nb_endo x (nlag*nb_endo) x nb_states) or (nb_endo x (nlag*nb_endo)) matrix of coefficients non constant coefficients, depending on whether the non constant coefficients switch or not
* sigma = either a (nb_endo x (nlag*nb_endo) x nb_states) or (nb_endo x (nlag*nb_endo)) matrix of coefficients non constant coefficients, depending on whether the non constant coefficients switch or not
* y_artificial = a (T x nb_endo) matrix of artifical values drawn from the Markov-switching model given as an input
T=1000; nb_endo=2; nb_states=2; p=2; C=matrix([0.5 0.3 0.4 0.2 ; 0.7 -0.5 0.2 -0.1 ; 0.1 0.6 0.8 -0.6 ; 0.1 0.2 0.5 -0.6 ],2,4,2); cte=[0 1 ; 0.4 -0.4 ]; y0=grand(p,nb_endo,'nor',0,1); y=msvar_draw(T,nb_endo,p,nb_states,1,'all',y0,[0.8 0.15 ; 0.2 0.85],cte,C,[0.2 0.1 ; 0.1 0.3]); // an artifical msvar with 2 endogenous, 2 states, 2 lags, all coefficients switching, // transition probabilities matrix = [0.8 0.15 ; 0.2 0.85], variances not switching and // =[0.8 0.15 ; 0.2 0.85] | ![]() | ![]() |