TVTP Markov Regime switching model

Discussion of models with structural breaks or endogenous switching.

TVTP Markov Regime switching model

Postby superper2008 » Tue Mar 27, 2012 4:10 pm

Dear Tom:

Now I met one big touble to apply Markov regime switching TM model (to test market timing) from a new paper "Business cycles and mutual fund timing performance: an application of regime switching and Garch modelling". In the paper, the authors uses transition probability model to find time varying probability depending on one economic indicator (VIX) by equation P(t)= cumulative normal function (c1+d1*log (vix(t-1)); Q(t)=cumulative normal function (c2+d2*log(VIX(t-1))). And then they estimate C1,C2,D1 and D2. (Ithink that I can estimate them by means of RATS, right? ).

Moreover, when getting c1,c2, d1 and d2, the authors regards d1 (negative) as state 1(S1) and regard d2 (positive) as state 2(S2). Finally the authors appply these four estimators derived from transition probability modelling into markov regime TM switching (in the paper, they extended markov switching by adding one more varialbes). The equation is shown in the following: return(j,t)= alpha(j, St)+beta(j, St)*X+gamma(t,St)*(X^2)+error term; error term follows N(0, Variance(St)). However, I have no idea how to apply c1,c2,d1, d2 into the extended markov regime switching model [return(j,t)= alpha(j, St)+beta(j, St)*X+gamma(t,St)*(X^2)+error term]when using RATS to estimate the coefficients of time varying transtion probability modelling.

Could you give me some suggestions how to code them by means of RATS.

Appreciate you very much for your patience, help and consideration. Look forward to your reply at your earliest convenience.

Best regards,
Feiyu
superper2008
 
Posts: 35
Joined: Tue Mar 27, 2012 12:48 pm

Re: TVTP Markov Regime switching model

Postby TomDoan » Wed Mar 28, 2012 1:27 pm

That will be similar to the Filardo JBES 1994 replication:

http://www.estima.com/forum/viewtopic.php?f=30&t=513

except they are using Normal rather than logistics to compute the time-varying probabilities. To convert the rather slow maximum likelihood estimates would be a very simple adjustment to the %MSVARPMAT function---the following two lines are specific to the logistic:

Code: Select all
compute p(1,1)=%(z=exp(%dot(%eqnxvector(p1eq,time),v1)),z/(1+z))
compute p(1,2)=%(z=exp(%dot(%eqnxvector(p2eq,time),v2)),1/(1+z))
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Re: TVTP Markov Regime switching model

Postby superper2008 » Wed Mar 28, 2012 4:18 pm

Dear Tom:

Appreciate you very much for your help. However, I have one small question about that. When I estimate the coefficients (c1,c2,d1,d2) by means of filardo replications, I have to use these four coefficents which determine state 1(d1<0) or state 2 (d2>0) and put them into the extended markov regime switching model [return(j,t)= alpha(j, State)+beta(j, State)*X+gamma(t,State)*(X^2)+error term, in the model, there are totally six coefficients estimated in two different states respectively (alpha1, alpha2, beta1, beta2, gamma1and gamma2). Could you please give me more suggestions about that?

Appreciate your very much for your help.

Sincerely,
Feiyu
superper2008
 
Posts: 35
Joined: Tue Mar 27, 2012 12:48 pm

Re: TVTP Markov Regime switching model

Postby TomDoan » Wed Mar 28, 2012 5:40 pm

Filardo is actually more complicated than that, because he is using a Hamilton style mean switching model which requires augmenting regimes to handle all the combinations for current and four lags. I'm not sure what you mean by "extended Markov regime switching model". That looks like a relatively straightforward Markov switching linear regression other than time-varying transitions.
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Re: TVTP Markov Regime switching model

Postby superper2008 » Wed Mar 28, 2012 6:59 pm

Hello Tom:

Appreciate you for your help. You are right. The model I are using is one linear regressionl with two independent variables. However, I have to use c1,c2, d1,d2 derived from time varying transition probability modelling (normal function) to put them into the linear regression. Could you please give me some suggestions about them? Which example can I refer to in RATS forum?

Thanks again for your reply and kindly help.

Regards,
Feiyu
superper2008
 
Posts: 35
Joined: Tue Mar 27, 2012 12:48 pm

Re: TVTP Markov Regime switching model

Postby superper2008 » Wed Mar 28, 2012 8:24 pm

Hello Tom:

I may make one mistake. The markov regime switching model should be one non-linear regression with two independent variables including X and Y. Could you please give me more suggestions how to code them by using coeffients estimated from time varying transition probability>

Thank you very much for your understanding.

Sincerely,
Feiyu
superper2008
 
Posts: 35
Joined: Tue Mar 27, 2012 12:48 pm

Re: TVTP Markov Regime switching model

Postby TomDoan » Thu Mar 29, 2012 10:42 am

superper2008 wrote:Hello Tom:

I may make one mistake. The markov regime switching model should be one non-linear regression with two independent variables including X and Y. Could you please give me more suggestions how to code them by using coeffients estimated from time varying transition probability>

Thank you very much for your understanding.

Sincerely,
Feiyu


Actually, it's linear in the parameters---X^2 is just another explanatory variable. Have you tried estimating this with fixed transitions first?
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Re: TVTP Markov Regime switching model

Postby superper2008 » Thu Mar 29, 2012 11:36 am

Hello Tom:

Appreciate you very much for your help. Now I am using Fillaro replication to estimate time varying transition probability modelling (normal function), but I found that it is very complicated to apply the code into my model because in the model, it only uses cumulative normal function to establish the relationship between transition probability and one economic indicator. Could you please give more suggestions how to simplify Fillaro repliaction code because I don't need the mean switching model?

After I estimated these four coefficents (c1,c2,d1,d2) of the transition probability modelling, I could determinie state according to d1 and d2. It means that d1 leads to state 1 and d2 leads to state 2. And then I have to use d1 and d2 and put them into the linear regression. However, I have no a clear picture how to relate time varying coefficients to the linear regression. Can I use Fillaro replication code to estimate the linear regression or have to write another code to estimate alpha, beta and gamma in two states respectively?

Could you please give me more suggestions? Apprreciate you very much for your kindly assistance on the model.

Sincerely,
Feiyu
superper2008
 
Posts: 35
Joined: Tue Mar 27, 2012 12:48 pm

Re: TVTP Markov Regime switching model

Postby superper2008 » Thu Mar 29, 2012 11:43 am

Hello Tom:

I don't need to estimate the linear regression with fixed transitions first. However, I need to estimate the linear regresssion with time varying transition probability. Could you please give me more suggestion how to code them?

Appreciate you very much for your immediate reply and kindly help.

Best regards
Feiyu
superper2008
 
Posts: 35
Joined: Tue Mar 27, 2012 12:48 pm

Re: TVTP Markov Regime switching model

Postby superper2008 » Fri Mar 30, 2012 1:41 pm

Hello Tom:

I have been trying my best to apply Filardo code to my model. However, it is hard for me to simplify them into normal function of time varying transition probability of my model to estimate the coefficients. I also need to estimate the linear regression with the time varying transition probability.

Appreciate you very much for your help.

Sincerely,
Feiyu
Attachments
mutual fund regime switching.pdf
the source of the model
(661.11 KiB) Downloaded 66 times
superper2008
 
Posts: 35
Joined: Tue Mar 27, 2012 12:48 pm

Re: TVTP Markov Regime switching model

Postby TomDoan » Fri Mar 30, 2012 4:11 pm

superper2008 wrote:Hello Tom:

I don't need to estimate the linear regression with fixed transitions first.


Actually, you do, because that's how you do (good) empirical work. You don't start with the most complicated model that you might think of estimating. An example where the basic model is more similar to what you're doing than Filardo's (which again is a mean-switching Hamilton model, rather than a simple switching linear regression) is posted here:

http://www.estima.com/forum/viewtopic.php?f=8&t=1400
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Re: TVTP Markov Regime switching model

Postby superper2008 » Sun Apr 01, 2012 2:46 pm

Hello Tom:

Appreciate you very much for your suggestion about markov simple linear regression. Could you please give me one example about markov multivariate linear regression by using @mssysregression? Because in my model, I will estimate several coeffiicents of intercepts, betas and gammas with state-dependent variance.

Besides, when I am using Filardo's code to estimate the time varying probability transition modelling, it is a little difficult to write the code about P(1,1) and P (1,2) because Filardo uses logistic function,[p(1,1)=%(z=exp(%dot(%eqnxvector(p1eq,time),v1)),z/(1+z)),p(1,2)=%(z=exp(%dot(%eqnxvector(p2eq,time),v2)),1/(1+z))], but I will use cumulative normal function P=f(c1+c2(log(X,t-1))), q=f(d1+d2(log(x,t-1))), could you please help me to code the normal function?

Appreciate you very much for your kindly help.

Sincerely,
Feiyu
superper2008
 
Posts: 35
Joined: Tue Mar 27, 2012 12:48 pm

Re: TVTP Markov Regime switching model

Postby TomDoan » Mon Apr 02, 2012 9:47 am

superper2008 wrote:Hello Tom:

Appreciate you very much for your suggestion about markov simple linear regression. Could you please give me one example about markov multivariate linear regression by using @mssysregression? Because in my model, I will estimate several coeffiicents of intercepts, betas and gammas with state-dependent variance.


See Ehrmann-Ellison-Valla(2003) http://www.estima.com/forum/viewtopic.php?f=8&t=1192

superper2008 wrote:Besides, when I am using Filardo's code to estimate the time varying probability transition modelling, it is a little difficult to write the code about P(1,1) and P (1,2) because Filardo uses logistic function,[p(1,1)=%(z=exp(%dot(%eqnxvector(p1eq,time),v1)),z/(1+z)),p(1,2)=%(z=exp(%dot(%eqnxvector(p2eq,time),v2)),1/(1+z))], but I will use cumulative normal function P=f(c1+c2(log(X,t-1))), q=f(d1+d2(log(x,t-1))), could you please help me to code the normal function?


The use of the %EQNXVECTOR allows for easier change from one set of explanatory variables to another. The whole %dot(.....) evaluates the "index" which in your case is c1+c2*log(X(time-1)) for evaluating p(1,1) and d1+d2*log(x(time-1)) for evaluating p(2,2). You can either stick with the direct coding, or you can use

Code: Select all
equation p1eq *
# constant logx{1}
equation p2eq *
# constant logx{1}


(logx being a generated series) to define the two sets of linear functions for the indexes. With your original coding, you would want

p(1,1)=z=c1+c2*log(X(time-1)),%cdf(z)
p(1,2)=z=d1+d2*log(X(time-1)),%cdf(-z)

(The minus sign in the second is because you have a model for p(2,2), not p(1,2)).
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Re: TVTP Markov Regime switching model

Postby superper2008 » Mon Apr 02, 2012 11:43 am

Hello Tom:

Appreciate you very much for your kindly help. I will apply the code into my model. Now, the current version of Winrats I am using is 8.0 pro. Could I have to update to rats 8.1 to execute @msysregression and @msvarsteup function?

Thanks again,

Best regards,
Feiyu
superper2008
 
Posts: 35
Joined: Tue Mar 27, 2012 12:48 pm

Re: TVTP Markov Regime switching model

Postby TomDoan » Mon Apr 02, 2012 3:14 pm

superper2008 wrote:Hello Tom:

Appreciate you very much for your kindly help. I will apply the code into my model. Now, the current version of Winrats I am using is 8.0 pro. Could I have to update to rats 8.1 to execute @msysregression and @msvarsteup function?

Thanks again,

Best regards,
Feiyu


Your university should have version 8.1. It just must not be installed yet. You might want to check with your IT department.
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Next

Return to Structural Breaks and Switching Models

Who is online

Users browsing this forum: No registered users and 2 guests

cron