Page 1 of 2
Filardo JBES 1994 Time-Varying MS Model

Posted:
Wed Feb 29, 2012 11:28 am
by TomDoan
Updated March 1, 2012 to use most recent version of MSVARSETUP.SRCThe 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.
Re: Filardo JBES 1994 Time-Varying MS Model

Posted:
Sat Sep 08, 2012 1:33 pm
by FaeK
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
Re: Filardo JBES 1994 Time-Varying MS Model

Posted:
Sat Sep 08, 2012 2:43 pm
by TomDoan
Did you download the new MSVARSETUP as described in the comments?
Re: Filardo JBES 1994 Time-Varying MS Model

Posted:
Mon Sep 10, 2012 5:42 am
by FaeK
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
Re: Filardo JBES 1994 Time-Varying MS Model

Posted:
Tue Sep 11, 2012 1:15 pm
by FaeK
Dear Tom,
I could not figure out why I get such message. Is it because the code is not reading MSVARSETUP?
Kinds
Re: Filardo JBES 1994 Time-Varying MS Model

Posted:
Wed Sep 12, 2012 4:19 am
by hasanov
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.
Re: Filardo JBES 1994 Time-Varying MS Model

Posted:
Wed Sep 12, 2012 8:05 am
by FaeK
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
Re: Filardo JBES 1994 Time-Varying MS Model

Posted:
Wed Sep 12, 2012 9:59 am
by TomDoan
Yes. Those are the required adjustments.
Re: Filardo JBES 1994 Time-Varying MS Model

Posted:
Wed Sep 12, 2012 1:59 pm
by FaeK
Thank you very much, Tom.
Re: Filardo JBES 1994 Time-Varying MS Model

Posted:
Thu Sep 13, 2012 9:28 am
by FaeK
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
Re: Filardo JBES 1994 Time-Varying MS Model

Posted:
Fri Sep 14, 2012 10:49 am
by TomDoan
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.
Re: Filardo JBES 1994 Time-Varying MS Model

Posted:
Mon Sep 17, 2012 11:06 am
by FaeK
Dear Tom,
Thank you so much for your great help. Indeed, it worked perfectly.
Many thanks
Faek
Re: Filardo JBES 1994 Time-Varying MS Model

Posted:
Tue Sep 18, 2012 6:26 pm
by FaeK
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
Re: Filardo JBES 1994 Time-Varying MS Model

Posted:
Wed Sep 19, 2012 10:46 am
by TomDoan
You would have to post the code and data for a case that fails.
Re: Filardo JBES 1994 Time-Varying MS Model

Posted:
Wed Sep 19, 2012 11:56 am
by FaeK
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