ms_mean — Markov Switching mean-variance model
r=ms_mean(endo,MS_M,MS_M_V,MS_var_opt,arg1, ,argn)
endo =
- (T x K) string matrix of endogenous variables
or:
- a list containing all the endogenous variables in an_y 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') = 'ms mean'
* r('typmod') = 1
* r('y') = a (N x n_y) matrix of original endogenous variables
* r('x') = the (N x n_x) matrix of exogenous switching regressors = ones(T,n_x)
* r('z') = the [] 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 [] 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 K*M) vector of switching parameters
* r('beta_co') = the [] 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 K*M) vector of t-stats for switching parameters
* r('beta_co_tstat') = the [] 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 [] 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 (n_y x 1) vector of names of the endogenous variables
* r('namex_id') = the name of the swicthing exogenous variables = 'cte'
* r('namex_co') = the [] 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 is 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('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
load('C:\SCI\macros\grocer\db\anas.dat') bounds('1984m2','2003m1') nb_states=3 switch_var=1 var_opt=1 r=ms_mean(['delts(log(construc))';'delts(log(ipi))';'delts(log(helpwanted))';'delts(log(revu))'],nb_states,switch_var,var_opt,'transf=stud','datation=datation_bb') This example is taken from function ms_mean_d. The endogenous variables are 'delts(log(construc))', 'delts(log(ipi))', 'delts(log(helpwanted))' and 'delts(log(revu))'. There are 3 states, the variances are not switching (switch_var=1) and the var-cov matrix is heteroskedastic (var_opt=1). Two optional arguments have been given: 'transf= stud' which means that variables are studentuzed before estimation and 'datation=datation_bb' which means that the an priori datation (provided by Benoit Bellone) is given.