Markvov Switching regression model
res=ms_estimate(y,x,z,transf,MS_typmod,MS_M,MS_M_V,MS_var_opt,MS_apriori,prt,init_beta_id,init_beta_co,init_prob,init_var,tstat,optfunc,opt_optim)
* y = (T*K x 1) matrix of stacked endogenous variables
* x = (T*K x sum(n_x)) matrix of switching exogenous variables
* z = (T*K x sum(n_z)) matrix of non switching exogenous variables
* nx = (K x 1) vector, with nx(i)=# of switching exogenous variables for edogenous i
* nz = (K x 1) vector, with nz(i)=# of non switching exogenous variables for edogenous i
* MS_typmod= type of MS model
- 1: mean-variance switching model
- 2: MS VAR regime dependent model
- 3: MS VAR intercept regime dependent model
- 4: partially regime dependent MS regression model
- 5: regime dependent MS regression model
* MS_M= a scalar equal the # of states
* MS_V = a scalar:
- 1 if the variance of the residuals is the same for all states
- MS_M if the variance of the residuals differs among the states
* MS_var_opt = a scalar:
- 1 if the variance of residuals is heteroskedastic
- 2 if the variance of residuals is homoskedastic
- 3 if the variance of residuals is unconstrained
* MS_apriori =
- 0 if there is no a priori datation
- 1 if there is an priori datation
* prt = %t if the initial values of the parameters are to be printed
* init_beta_id= either starting values for the coefficients of the switching variables (if the user has given ones) or the boolean %f (if the user has not given starting values)
* init_beta_co= either starting values for the coefficients of the non switching variables (if the user has given ones) or the boolean %f (if the user has not given starting values)
* init_prob= either starting values for the coefficients of the transition probabilities (if the user has given ones) or the boolean %f (if the user has not given starting values)
* init_var= either starting values for the coefficient of the variances (if the user has given ones) or the boolean %f (if the user has not given starting values)
* tstat = %t or %f whether the user wants to calculate the Student statistics or not
* optfunc = a string, the name of the optimisation function ('optim' or 'optimg')
* opt_optim = a tlist, collecting the options to the optimisation function
res = a results tlist with:
- res('meth') = model literal type ('ms mean' 'ms var' or 'ms regression')
- res('typmod') = model numbered type
- res('y') = a (T x K) matrix of original endogenous variables
- res('ymat') = (T*K x 1) matrix of stacked endogenous variables
- res('xmat') = (T*K x sum(n_x)) matrix of switching exogenous variables
- res('zmat') = (T*K x sum(n_z)) matrix of non switching exogenous variables
- res('switching V') = a scalar:
. 1 if the variance does not switch with the states
.M if the variance switches with the states
- res('var_opt') = a scalar:
. 1 if the variance of residuals is heteroskedastic
. 2 if the variance of residuals is homoskedastic
. 3 if the variance of residuals is unconstrained
- res('nobs') = the # if observations
- res('nendo') = the # of endogenous variables
- res('nb_states') = the # of states
- res('coeff') = the (np x 1) vector of parameters
- res('llike') = the log-likekihood
- res('grad') = the gradient at the solution
- res('yhat') = the adjusted y
- res('filtered resid') = the filtered residuals of the regression
- res('dll') = the degrees of freedom
- res('prob_st') = the (M x 1) vector of egodic state probabilities
- res('ptrans') = the (M x M) matrix of transition probabilities
- res('sigma') = the (M*M_V x M) variance-covariance matrix of the residuals
- res('beta_id') = the (1 x sum(n_x)*M) vector of switching parameters
- res('beta_co') = the (1 x sum(n_z)) vector of non switching parameters
- res('inv_sigma') = the (K x K) inverse of the variance matrix
- res('det_inv_sigma') = the determinant of the inverse of the variance matrix
- res('filtered probs') = the (T x M) vector of filtered probabilities
- res('smoothed probs') = the (T x M) vector of smoothed probabilities
- res('n_x') = the (K x 1) vector of the numbers of switching exogenous variables for each endogenous variable
- res('n_z') = the (K x 1) vector of the numbers of non switching exogenous variables for each endogenous variable
- res('stderr') = the (np x 1) vector of coefficients standard errors
- res('hes. delta') = the numerical increment for the calculation of the hessian matrix
- res('tstat') = the (np x 1) vector of associated t-stats
- res('pvalue') = the (np x 1) vector of associated p-values
- res('covbeta') = the (np x np) variance-covariance matrix of the parameters
- res('corbeta') = the (np x np) correlation matrix of the parameters
- res('ptrans_tstat') = the (M x 1) vector of t-stats for the transition probabilities
- res('beta_id_tstat') = the (1 x n_x*K*M) vector of t-stats for switching parameters
- res('beta_co_tstat') = the (1 x n_z*K) vector of t-stats for non switching parameters
- res('sigma_tstat') = the (M*M_V x M) matrix of t-stats for the variance-covariance matrix of the residuals
- res('ptrans_pvalue') = the (M x M) matrix of t-stats for transition probabilities
- res('beta_id_pvalue') = the (1 x n_x*K*M) vector of t-stats for switching parameters
- res('beta_co_pvalue') = the (1 x n_z*K) vector of t-stats for non switching parameters
- res('sigma_pvalue') = the (M*M_V x M) matrix of t-stats for the variance-covariance matrix of the residuals
- res('smoothed resid') = the smoothed residuals of the regression
load(GROCERDIR+'\data\us_revu.dat') bounds('1967m4','2004m2') [x,namey,z]=explouniv(['100*(lagts(1,log(us_revu))-lagts(3,log(us_revu)))';... '100*(lagts(2,log(us_revu))-lagts(4,log(us_revu)))';'100*(lagts(3,log(us_revu))-lagts(5,log(us_revu)))'],'const') r=ms_estimate(y,x,z,3,1,4,2,2,3,[],%f,%f,%f,%f,%f,sqrt(%eps),%eps^0.25) // This example provides the estimation of a MS model on US (inverse) unemployment rate, with the constant (variable z) switching, type of moodel set to 4 (arg # 6: 4), 2 states (arg # 7: 2), // variances switching (arg # 8: 2), variances unconstarined (arg # 9: 3, irrelevant in that case), no a priori datation (arg 10: 4), no starting values (arg # 11 to 14: %f), // numerical increment used to calculate the gradient and hessain set to sqrt(%eps) (arg # 15) et %ep^0.25 (arg # 16). // Except for simulations, you should better use function ms_reg (in this case) or ms_mean or ms_var | ![]() | ![]() |