<< ms_mean_oos Markov-switching models ms_reg >>

Grocer >> Markov-switching models > ms_quali

ms_quali

Estimates a ms turning point model

CALLING SEQUENCE

res=ms_quali(coding,nbqua,nblatent,arg1,...,argn)

PARAMETERS

Input

* coding = the way variables will be coded:

    - 'KERN' = by quantiles estimated by the Epanechnikov kernel method

    - 'no' (or anything different from 'KERN') = data already coded

* nbqua = a (2 x 1 ) vector with nbqua(1) = # of quantiles used to divide the data (nbqua(2) can take any value)

* nblatent = # of latent variables (1 or 2)

* arg1,...,argn arguments which can be:

    -a time series

    -a real (nxp) vector

    -a string equal to the name of a time series or a (nxp) real vector between quotes

    -the string 'noprint' if the user doesn't want to print the results of the regression

    -'dropna' if the user wants to remove the NA values from the data

    -'testna=%f' if the user does not want to test if there are NA values in the series

    -'initparam=x' where x is a (nparam x 1) vector if the user wants to feed the estimation with her own starting values

    -'nbstates=x' where x is the # of states (compulsory if there is only 1 latent variable)

    -'nojump' to impose that the latent variables jump only to contiguous states

  - '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 turning point'

  - res('y') = original data

  - res('nobs') = # of observations

  - res('nvar') = # of variables

  - res('coded y') = data transformed by the coding

  - res('nb_quantiles') = # of quantiles used by the coding (if the kernel method has been used)

  - res('nb_latent') = # of latent state variable

  - res('nb_states') = # of states

  - res('nojump') = a boolean indicating whether the latent state is allowed to jump from a state to another non contiguous one

  - res('param') = vector of estimated parameters

  - res('std') = vector of associated standard errors

  - res('tstat') = vector of associated Steudent stats

  - res('llike') = log-likelihood

  - res('grad') = gradient at the solution

  - res('transition probabilities') = matrix of transition probabilities (if there is only 1 state latent variable)

  - res('transition probabilities') = matrix of transition probabilities (if there is only 1 state latent variable)

  - res('first transition probabilities') = matrix of transition probabilities for the first latent variable (if there are 2 state latent variables)

  - res('first transition probabilities') = matrix of transition probabilities for the second latent variable (if there are 2 state latent variables)

  - res('conditional probabilities') = matrix of conditional probabilities (if there is only 1 state latent variable)

  - res('filtered probabilities') = matrix of filtered state probabilities

  - res('smoothed probabilities') = matrix of smoothed state probabilities

  - res('PZ_std') = matrix of standard errors for the transition probabilities for the first latent variable

  - res('PW_std') = matrix of standard errors for the transition probabilities for the second latent variable

  - res('PX_cond_std') = matrix of standard errors for the latent variable

  - res('prests') = boolean indicating the presence or absence of a time series in the regression

  - 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 regression, the bounds of the regression

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

DESCRIPTION

Estimates a ms turning point model.

EXAMPLE

load(GROCERDIR+'/macros/grocer/db/enq5.dat')
bounds()
 
 
//Example 1:
nbquantiles=[3,0];// 3 quantiles
nblatent=1;// 1 latent state
 
//with the option testna=%f because of lacking data
res1=ms_quali('KERN',nbquantiles,nblatent,'delts(3,B_ACTPA)','delts(3,C_VENPA)',...
'delts(3,I_PROPA)','delts(3,I_GOULOT)','delts(3,S_CAPA)','nbstates=3','testna=%f')
 
// Example 2:
//as indicated by the previous estimation, impose that a high state cannot jump to a low one with the option 'nojump'
res2=ms_quali('KERN',[3,0],1,'delts(3,B_ACTPA)','delts(3,C_VENPA)',...
'delts(3,I_PROPA)','delts(3,I_GOULOT)','delts(3,S_CAPA)','nbstates=3','testna=%f','nojump')
 
// Example 3:
// now estimate with Gregoir and Lenglart 2 states formulation
nbquantiles=[2,0];// 2 quantiles
nblatent=2;// 2 latent states
res3=ms_quali('KERN',nbquantiles,nblatent,'delts(3,B_ACTPA)',...
'delts(3,C_VENPA)','delts(3,I_PROPA)','delts(3,I_GOULOT)','delts(3,S_CAPA)','testna=%f')
 
// compare the indicators
ind2=res2ts(res2,'filtered indicator')
ind3=res2ts(res3,'filtered indicator')
pltseries('ind2','ind3','title=standard and Gregoir Lenglart turning point indicator','leg=standard;Gregoir-Lenglart')
 
// Examples taken from function ms_quali_d().
// These examples show how one can estimate the 3 main models
// (one with one latent state variable and possible jumps between not contiguous states,
// one with one latent state and no jump between not contiguous states
// and one with 2 latent variable) with data that contain some NA values.

AUTHOR

Eric Dubois 2009

Report an issue
<< ms_mean_oos Markov-switching models ms_reg >>