Filardo JBES 1994 Time-Varying MS Model

Discussion of models with structural breaks or endogenous switching.

Filardo JBES 1994 Time-Varying MS Model

Postby TomDoan » Wed Feb 29, 2012 11:28 am

Updated March 1, 2012 to use most recent version of MSVARSETUP.SRC

The following are the RATS program and data file for (somewhat) replicating the time-varying Hamilton-type switching model from Filardo(1994), "Business Cycle Phases and Their Transitional Dynamics", JBES, vol 12, no 3, 299-308. This requires the new MSVARSETUP.SRC procedure from http://www.estima.com/forum/viewtopic.php?f=7&t=512. We're fairly sure this does the estimation correctly given the data used. The paper, unfortunately, is rather vague on a few data preparation steps, and has some rather blatant errors in table 1 (the p-values don't match the AIC/SC).

This includes code for both EM and ML estimation. (It does EM for a certain number of iterations, then switches to maximum likelihood to get final estimates including standard errors). Maximum likelihood is not precisely defined for models with time-varying transition probabilties, since there is no unique ergodic solution for the pre-sample probabilities. This uses the probabilities with zero values for the explanatory variables to compute those. Because of this, the EM and ML use a different calculation for the likelihood, so "converged" EM estimates won't immediately give the same results in ML.

filardo_em.rpf
Program file
(9.41 KiB) Downloaded 183 times

filardo.dat
Data file
(43.01 KiB) Downloaded 461 times
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Re: Filardo JBES 1994 Time-Varying MS Model

Postby FaeK » Sat Sep 08, 2012 1:33 pm

Dear Tom,

I hope that you are well. I tried to replicate Filardo (1994) code, however, I got this message:

[## SX11. Identifier EMSIZE is Not Recognizable. Incorrect Option Field or Parameter Order?
>>>> do k=1,EMSize<<<<]

I am using RATS 8.1, though. I really appreciation your help and cooperation.

Many thanks
Faek
FaeK
 
Posts: 36
Joined: Tue Jan 03, 2012 9:01 pm

Re: Filardo JBES 1994 Time-Varying MS Model

Postby TomDoan » Sat Sep 08, 2012 2:43 pm

Did you download the new MSVARSETUP as described in the comments?
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Re: Filardo JBES 1994 Time-Varying MS Model

Postby FaeK » Mon Sep 10, 2012 5:42 am

Dear Tom,

Many thanks for the prompt reply. Yes, I have downloaded it. The fixed transition probabilities get estimated properly, however, when estimating the time varying probabilities, I get such message.

Many thanks
Faek
FaeK
 
Posts: 36
Joined: Tue Jan 03, 2012 9:01 pm

Re: Filardo JBES 1994 Time-Varying MS Model

Postby FaeK » Tue Sep 11, 2012 1:15 pm

Dear Tom,

I could not figure out why I get such message. Is it because the code is not reading MSVARSETUP?

Kinds
FaeK
 
Posts: 36
Joined: Tue Jan 03, 2012 9:01 pm

Re: Filardo JBES 1994 Time-Varying MS Model

Postby hasanov » Wed Sep 12, 2012 4:19 am

You've mentioned that there was a failure when running the code. Thus, I have also tried to run the whole code. And, there was no any problem throughout the code. The results were shown clearly and completely. My RATS version is 8.1 as well.
hasanov
 
Posts: 7
Joined: Tue May 29, 2012 7:31 pm

Re: Filardo JBES 1994 Time-Varying MS Model

Postby FaeK » Wed Sep 12, 2012 8:05 am

Many thanks for your reply. Actually, after surfing the previous discussion on the forum , I realized that the code has been updated which is I did not have it. I was using the old one. It is has been sorted out now. The code is switching only the mean, if I am gonna switch the mean and the variance. I have to set:
@MSVARSetup(lags=nlags,switch=Mh)
# g
and use sigmav instead of sigma. Am I right? the code had worked in this way, but I am not sure whether I am correct or not.

Thank you very much for help again.
Faek
FaeK
 
Posts: 36
Joined: Tue Jan 03, 2012 9:01 pm

Re: Filardo JBES 1994 Time-Varying MS Model

Postby TomDoan » Wed Sep 12, 2012 9:59 am

Yes. Those are the required adjustments.
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Re: Filardo JBES 1994 Time-Varying MS Model

Postby FaeK » Wed Sep 12, 2012 1:59 pm

Thank you very much, Tom.
FaeK
 
Posts: 36
Joined: Tue Jan 03, 2012 9:01 pm

Re: Filardo JBES 1994 Time-Varying MS Model

Postby FaeK » Thu Sep 13, 2012 9:28 am

Dear Tom,

I have one last question. Filardo estimate is based on one independent variable on the time-varying probabilities. However, I have two independent variables. Do you have any suggestions how to adjust the code for the addressing the impact of two variables?

Many thanks
Faek
FaeK
 
Posts: 36
Joined: Tue Jan 03, 2012 9:01 pm

Re: Filardo JBES 1994 Time-Varying MS Model

Postby TomDoan » Fri Sep 14, 2012 10:49 am

The example already has that. This does two lags rather than one on the indicator variable so it has two explanatory variables:

equation p1eq *
# constant xli{1 2}
equation p2eq *
# constant xli{1 2}

There's no reason the indicators need to be lags of one variable---they can be two unrelated variables.
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Re: Filardo JBES 1994 Time-Varying MS Model

Postby FaeK » Mon Sep 17, 2012 11:06 am

Dear Tom,

Thank you so much for your great help. Indeed, it worked perfectly.

Many thanks
Faek
FaeK
 
Posts: 36
Joined: Tue Jan 03, 2012 9:01 pm

Re: Filardo JBES 1994 Time-Varying MS Model

Postby FaeK » Tue Sep 18, 2012 6:26 pm

Dear Tom,

Sorry to bother you again. Applying Filardo code on my own data, the code works perfectly for some cases (countries) and I got proper estimation for TVP,however, in some other cases, I always get this message when estimating TVP:

[## MAT13. Store into Out-of-Range Matrix or Series Element
The Error Occurred At Location 539, Line 31 of MSVARTVPEMESTIMA]

I have adjusted the initial values which is I thought because of that, but I get the same message. I am not sure why? I do appreciate any hints from you.

Many thanks
Faek
FaeK
 
Posts: 36
Joined: Tue Jan 03, 2012 9:01 pm

Re: Filardo JBES 1994 Time-Varying MS Model

Postby TomDoan » Wed Sep 19, 2012 10:46 am

You would have to post the code and data for a case that fails.
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Re: Filardo JBES 1994 Time-Varying MS Model

Postby FaeK » Wed Sep 19, 2012 11:56 am

Dear Tom,

Thank you very much. I really appreciate your effort with me. I have attached the data and the code now.

Many thanks
Faek
Attachments
code.RPF
(5.94 KiB) Downloaded 58 times
Data.xlsx
(18.64 KiB) Downloaded 43 times
FaeK
 
Posts: 36
Joined: Tue Jan 03, 2012 9:01 pm

Next

Return to Structural Breaks and Switching Models

Who is online

Users browsing this forum: No registered users and 0 guests