<< ms_reg_oos Markov-switching models ms_var_oos >>

Grocer >> Markov-switching models > ms_var

ms_var

Markov Switching VAR model

CALLING SEQUENCE

r=ms_var(MS_typvar,MS_p,endo,MS_M,MS_M_V,MS_var_opt,arg1,...,argn)

PARAMETERS

Input

* 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)

* 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

  - 'init_beta_id = xxx' where xxx is a vector of starting values for the switching exogenous variables

  - 'init_beta_co = xxx' where xxx is a vector of starting values for the non switching exogenous variables

  - 'init_prob' = xxx' where xxx is a matrix of starting values for the transition probabilities

  - 'init_var' = xxx' where xxx is a matrix of starting values for the variances

  - 'init_var' = xxx' where xxx is a matrix of starting values for the variances

  - 'notstat' if the user does not want to calculate the Student statistics of the parameters

  - 'optfunc=optim' if the user wants to use the optim optimisation function (default: optimg)

  - 'opt_nelmead=crit,nitermax' with crit the value of the convergence criterion in the Nelder-Meade optimisation function and nitermax the maximum number of iterations (default = 'opt_nelmead=2*%eps,1000')

  - 'opt_optim=opts' where opts are options for optim that can be entered after the starting value of the parameters (default = 'opt_optim=,''ar'',1e6,1e6'')

  - 'opt_convg=val' where val is the threshold on gradient norm (default = 'opt_convg=1e-5')

 

Output

* res = a results tlist with:

  - res('meth') = 'ms var'

  - 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') = the (T x M) matrix of -transformed- non switching regressors

  - 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

  - res('prests') = a boolean indicating whether there are ts in the regression

  - res('datation') = the a priori datation if any

  - res('namedat') = the name of the series used for an a priori datation if any

  - res('namey') = name of the y variable

  - res('namex') = name of the x variables

  - res('dropna') = boolean indicating if NAs have been dropped

  - res('bounds') = if there is a timeseries in the forecast, the bounds of the regression

  - res('nonna') = vector indicating position of non-NAs

DESCRIPTION

Estimates a Markvov Switching (MS) VAR model by the maximum likelihood method.

EXAMPLE

load(GROCERDIR+'\macros\grocer\db\us_revu.dat')
bounds('1967m4','2004m2')
nb_states=2
switch_var=2
var_opt=3
r=ms_var('cte',3,'100*(log(us_revu)-lagts(2,log(us_revu)))',nb_states,switch_var,var_opt,'prt=initial;final','transf=stud')

AUTHOR

Benoit Bellone/Eric Dubois 2006-2007

Report an issue
<< ms_reg_oos Markov-switching models ms_var_oos >>