ms_var — Markov Switching VAR model
r=ms_var(MS_typvar,MS_p,endo,MS_M,MS_M_V,MS_var_opt,arg1, ,argn)
MS_typvar =
- 'all' if the constant AND the endogenous variables are switching exogenous variables
- 'cte' if only the constant is a switching exogenous variable
MS_p = the VAR lag order
endo =
- (T x K) string matrix of endogenous variables
or:
- a list containing all the endogenous variables in any of the following form:
* a time series
* a real matrix
* a string representing such objects
* the string 'const' (for the constant variable)
exo_com =
- (T x K) string matrix of non switching exogenous variables
or:
- a list containing all the non switching exogenous variables in any of the following form:
* a time series
* a real matrix
* a string representing such objects
* the string 'const' (for the constant variable)
exo_idio =
- (T x K) string matrix of switching exogenous variables
or:
- a list containing all the switching exogenous variables in any of the following form:
* a time series
* a real matrix
* a string representing such objects
* the string 'const' (for the constant variable)
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
arg1, argn = optional arguments which can be:
- 'datation=xx' where xx is the name of a series used as an a priori datation (default: no a priori datation)
- 'transf=xx' where xx is either 'dem' if the user wants all series to be demeaned or 'stu' if the user wants all series to be studentized (default: no transformation)
- 'gdelta=xx' where xx is a number used to calculate the numerical derivative of the log-likelihood (default 1e-4)
- 'hdelta=xx' where xx is a number used to calculate the numerical hessian (default 1e-5)
- 'prt=xx' where xx='nothing', 'final', 'all' or ['initial';'final'] if the user wants to print nothing, only the final results or the final and the initial results
- 'noprint' if the user wants to print nothing (equivalent to 'prt=nothing')
- the string 'dropna' if the user wants to remove the NA values from the data
r = a results tlist with:
- r('meth') = model literal type: 'ms var'
- r('typmod') = model numbered type
- r('y') = a (N x M) matrix of original endogenous variables
- r('x') = the (N x n_x) matrix of exogenous switching regressors
- r('z') = the (N x n_z) matrix of exogenous non switching regressors
- r('ymat') = the (N x M) matrix of -transformed- endogenous variables
- r('xmat') = the (N x n_x) matrix of -transformed- exogenous switching regressors
- r('zmat') = the (N x n_z) matrix of -transformed- non switching regressors
- r('switching V') = a scalar:
* 1 if the variance does not switch with the states
* M if the variance switches with the states
- r('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
- r('nobs') = the # if observations
- r('nendo') = the # of endogenous variables
- r('nb_states') = the # of states
- r('coeff') = the (np x 1) vector of parameters
- r('llike') = the log-likekihood
- r('grad') = the gradient at the solution
- r('yhat') = the adjusted y
- r('resid') = the residuals of the regression
- r('dll') = the degrees of freedom
- r('prob_st') = the (M x 1) vector of egodic state probabilities
- r('ptrans') = the (M x M) matrix of transition probabilities
- r('sigma') = the (M*M_V x M) variance-covariance matrix of the residuals
- r('beta_id') = the (1 x n_x*K*M) vector of switching parameters
- r('beta_co') = the (1 x n_z*K) vector of non switching parameters
- r('inv_sigma') = the (K x K) inverse of the variance matrix
- r('det_inv_sigma') = the determinant of the inverse of the variance matrix
- r('smoothed probs') = the (T x M) vector of smoothed probabilities
- r('stderr') = the (np x 1) vector of coefficients standard errors
- r('tstat') = the (np x 1) vector of associated t-stats
- r('pvalue') = the (np x 1) vector of associated p-values
- r('covbeta') = the (np x np) variance-covariance matrix of the parameters
- r('corbeta') = the (np x np) correlation matrix of the parameters
- r('ptrans_tstat') = the (M x 1) vector of t-stats for the transition probabilities
- r('beta_id_tstat') = the (1 x n_x*K*M) vector of t-stats for switching parameters
- r('beta_co_tstat') = the (1 x n_z*K) vector of t-stats for non switching parameters
- r('sigma_tstat') = the (M*M_V x M) matrix of t-stats for the variance-covariance matrix of the residuals
- r('ptrans_pvalue') = the (M x M) matrix of t-stats for transition probabilities
- r('beta_id_pvalue') = the (1 x n_x*K*M) vector of t-stats for switching parameters
- r('beta_co_pvalue') = the (1 x n_z*K) vector of t-stats for non switching parameters
- r('sigma_pvalue') = the (M*M_V x M) matrix of t-stats for the variance-covariance matrix of the residuals
- r('namey') = the (ny x 1) vector of names of the endogenous variables
- r('namex_id') = the (n_x x 1) vector of names of the swicthing exogenous variables
- r('namex_co') = the (n_x x 1) vector of names of the non swicthing exogenous variables
- r('apriori') = a scalar
* 0 if there is no a priori datation
* 1 if there is an a priori datation
- r('prests') = a boolean indicating whether there are ts in the regression
- r('prests') = a boolean indicating whether there are ts in the regression
- r('datation') = the a priori datation if any
- r('namedat') = the name of the series used for an a priori datation if any
- r('namey') = name of the y variable
- r('namex') = name of the x variables
- r('dropna') = boolean indicating if NAs have been dropped
- r('bounds') = if there is a timeseries in the forecast, the bounds of the regression
- r('nonna') = vector indicating position of non-NAs