Markov-switching UR test

If you are seeking RATS code for implementing a particular technique or replicating results from a paper, post your request here. Be sure to include complete citations for any papers or books.
charly63
Posts: 10
Joined: Tue Apr 14, 2009 6:06 pm

Markov-switching UR test

Unread post by charly63 »

Dear Tom,
I am working on gdp data and I would like to replicate in rats the results of the paper of S.G. Hall. Z. Psaradakis and M. Sola, "Detecting periodically collapsing bubble: A Markov-switching unit root test" J. of Appl. Economectrics, 1999, vol. 14 143-154, or a similar paper of M. Camacho, "Markov-switching models and the unit root hypothesis in real U.S. GDP", Economics Letters, 2011, vol. 112, issue 2, 161-164. The latter author share his Gauss codes that I enclose in attachment, but I was not able to translate them in rats code. Can I get some help about this issue?
Thanks in advance,

Charly
Attachments
MSUR.zip
(13.59 KiB) Downloaded 1076 times
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Markov-switching UR test

Unread post by TomDoan »

Just use the @MSRegression procedures with an NFIX option which covers all the explanatory variables except the constant.
charly63
Posts: 10
Joined: Tue Apr 14, 2009 6:06 pm

Re: Markov-switching UR test

Unread post by charly63 »

Dear Tom,
thanks for your reply. I have not problems with the MS estimation of the equation, the problem is to bootstrap, under the null of unit root hypothesis, the simulated critical values, as the null distribution of such statistics (the ADF test) is unknown.

Charly
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Markov-switching UR test

Unread post by TomDoan »

I'm not sure there's a statistical justification for parametric bootstrapping in that case---the residuals from the MS estimation aren't representative of the shocks required when you build the process with known (simulated) regimes.
charly63
Posts: 10
Joined: Tue Apr 14, 2009 6:06 pm

Re: Markov-switching UR test

Unread post by charly63 »

If I have understand well, given the MS equation Dy = c(st) + rho*y(t-1) + bt + g*Dy(t-i)
One can easily compute the t-statistic t(rho) associated with rho=0, but its distribution is non standard
and the procedure is that one should first save the ML parameter estimates and the residuals under the null (rho=0). Then generate a relatevely large number B of disturbances with sample size equals to that of the data generating process by bootstrapping the residuals. Therefore generate a dichotomous state variable by using the estimated transition probabilities, and then use the disturbances and the estimated parameters to generate realizations of y(t). The last one step is fit the MS equation to each realization and compute a set of B simulated t-statistics. The p-value of the unit root test is the percentage of the generated t-ratios that are below t(rho).
Do you think is it correct?
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Markov-switching UR test

Unread post by TomDoan »

Then generate a relatevely large number B of disturbances with sample size equals to that of the data generating process by bootstrapping the residuals.
I believe that's where the problem lies. The "residuals" from a switching model aren't the same as the shocks in the DGP, since the latter treat the regime as known, while the estimates don't. Parametric Normal simulations should be OK, but bootstrapping won't be.
charly63
Posts: 10
Joined: Tue Apr 14, 2009 6:06 pm

Re: Markov-switching UR test

Unread post by charly63 »

So, if I understand I should run a Monte Carlo test simulation with the instruction simulate in rats and compute the fractiles with the Statistics instruction.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Markov-switching UR test

Unread post by TomDoan »

It's more complicated than that, as you have to also simulate the MS process, then generate the data using that. The full example is at http://www.estima.com/forum/viewtopic.php?f=8&t=1955.
charly63
Posts: 10
Joined: Tue Apr 14, 2009 6:06 pm

Re: Markov-switching UR test

Unread post by charly63 »

Dear Tom,
thanks very much for the codes. However I would have a question, when I use the simulate code with a shorter sample (70 observations) it gives an error message
## SR10. Missing Values And/Or SMPL Options Leave No Usable Data Points
The Error Occurred At Location 756, Line 28 of loop/block
Of course with the new data I have changed the sample, the transition probailities, and so on. Do you think it needs more available data to work?
Thanks in advance

Charly
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Markov-switching UR test

Unread post by TomDoan »

There's no reason it wouldn't work with less data. Did you get the simpler estimation example adapted to your data set? This isn't an easy model to fit because of the instability of the deterministic coefficients so it might take some TLC to get it to estimate.
charly63
Posts: 10
Joined: Tue Apr 14, 2009 6:06 pm

Re: Markov-switching UR test

Unread post by charly63 »

Yes, with some changing iteration option in the istruction maximize I got the estimation adapted at my data, but when I try to run the simulate example with my data I got that error message. I enclose my data file if you want to try to replicate it.
Attachments
gdpcz.xls
(25 KiB) Downloaded 820 times
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Markov-switching UR test

Unread post by TomDoan »

I posted a fixed version of the Camacho program. If you replace the RESTRICT(NOPRINT,REPLACE) inside the loop with RESTRICT(NOPRINT,CREATE) it fixes the problem. (The REPLACE option doesn't reset %STDERRS and some of the other variables).
charly63
Posts: 10
Joined: Tue Apr 14, 2009 6:06 pm

Re: Markov-switching UR test

Unread post by charly63 »

Thanks so much Tom, now the simulate code seems to work fine :D
bekkdcc
Posts: 34
Joined: Wed Feb 24, 2016 4:21 am

Re: Markov-switching UR test

Unread post by bekkdcc »

Dear Tom,

I am replicating " Camacho(2011), "Markov-switching models and the unit root hypothesis in real U.S. GDP", Economics Letters, vol. 112,* 161-164" with its data set. I have some missing on the solutions of the rats program and the paper of Camacho...

Thanks in advance.
Attachments
Ask.docx
(151.17 KiB) Downloaded 815 times
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Markov-switching UR test

Unread post by TomDoan »

The regimes are reversed vs what's reported in the paper, but those are about as similar as you're likely to get without having the exact program used. The paper is reporting a y on y{1} lagged regression rather than the more standard dy on y{1}, so the unit root test statistic is the t test for the lagged dependent being 1 rather than 0. The RATS output has that at -3.83 rather than -4.20, but non-linear standard errors are dependent upon the algorithm used so even if the point estimates were spot on,there could be some (decided) differences in the "t"-statistic. The bootstrapped p-value of the test comes in quite a bit higher (thus not as significant) with the RATS code than he's showing. Again, the t-statistic depends upon the algorithm and this is doing 1000 silent possibly difficult non-linear estimations. I wouldn't put much confidence in the results, no matter what the software.

The graphs are simple---under the assumptions, the trend stationary is the IRF of an AR(1) (i.e. a geometric decline, his (3), ignoring the MS terms and the trend) and the other is the IRF of an ARIMA(1,1,0) (his (4) ignoring the MS terms). Note, however, that his (4) is not the unit root restricted version of (3)---the trend term has disappeared and an extra lag of y has shown up. I have no idea what (4) even is. The IRF in the unit-root restricted version of (4) would be straight across at 1.0.
Post Reply