Hi to all,
I have a series which consist of 109 observations and I am trying to test for stationary by using DFGLS. Even though Eviews allows me to compute the GLSdetrended DickeyFuller (Elliot, Rothenberg, and Stock, 1996) test, I want to calculate it myself just to make sure that I understand how it works and then compare it to the results that Eviews provides.But the problem is that for some reason I cannot reach the same results that Eviews provides.
Below is the list of the commands that I use.If anyone tells me where I messed up, it would be highly appreciated.
Some further info: ipi stands for industrial production index which I am testing for stationarity.exogenous variables are constant and linear trend.Lag length is not important because that is not the point.Sample range is 2002m012011m01.
scalar alpha=113.5/109
series ygls=ipialpha*ipi(1) ==> After this command I am opening ygls series and making the first ygls value which is NA same as the first ipi value.
series x1t=1alpha ==> and make X11=1
series t=@trend(2002m01,1)
series x2t=talpha*(t1)
ls ygls x1t x2t
The residuals that I get from the upper regression (ls ygls x1t x2t) are not the same as I get from Eviews's DFGLS test.If it was the same, what I was going to do is just to make a DickeyFuller test no constant and trend on the residuals and then that would have been it.
Thanks in advance anyone who contributes to the topic.
Testing for unit root using DFGLS
Moderators: EViews Gareth, EViews Moderator

 EViews Developer
 Posts: 2530
 Joined: Wed Oct 15, 2008 9:17 am
Re: Testing for unit root using DFGLS
Can you post your workfile?
Re: Testing for unit root using DFGLS
would you please state how to conduct DFGLS in eviews 9

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 11260
 Joined: Tue Sep 16, 2008 5:38 pm
Re: Testing for unit root using DFGLS
Hi agy038,
First of all i have to thank you because i had problem with ElliotRothenbergStock (ERS) Test manually too but in my case i had a confusion in calculating alpha (I put the trend instead of T(the number of observations)).
Well, let me help you now
After you regress ls ygls x1t x2t, you have to save the coefficients of the regressions. It is to say, save as follow:
scalar coefx1 = c(1)
scalar coefx2 = c(2)
After that, you have to detrend your originial variable which you want to take the ERS test with this coeficients estimated,it is to say:
gen ipi_detrended = ipi  (coefx1 + coefx2*t) (Notice that "coefx1 + coefx2*t" is the estimation of the deteministic part of your serie).
So now, you have to take the Augmented DickeyFuller(ADF) test to this variable and you will see that the t statistic will be the same; but notice that when you select the type of regression in the ADF test in eviews set none because you have already detrended the variable.
I hope it helps you altought it was posted 2 years ago heheh! I just have sucripted last week to this forum.
Greetings from Peru!
First of all i have to thank you because i had problem with ElliotRothenbergStock (ERS) Test manually too but in my case i had a confusion in calculating alpha (I put the trend instead of T(the number of observations)).
Well, let me help you now
After you regress ls ygls x1t x2t, you have to save the coefficients of the regressions. It is to say, save as follow:
scalar coefx1 = c(1)
scalar coefx2 = c(2)
After that, you have to detrend your originial variable which you want to take the ERS test with this coeficients estimated,it is to say:
gen ipi_detrended = ipi  (coefx1 + coefx2*t) (Notice that "coefx1 + coefx2*t" is the estimation of the deteministic part of your serie).
So now, you have to take the Augmented DickeyFuller(ADF) test to this variable and you will see that the t statistic will be the same; but notice that when you select the type of regression in the ADF test in eviews set none because you have already detrended the variable.
I hope it helps you altought it was posted 2 years ago heheh! I just have sucripted last week to this forum.
Greetings from Peru!
Who is online
Users browsing this forum: No registered users and 6 guests