For technical questions regarding estimation of single equations, systems, VARs, Factor analysis and State Space Models in EViews. General econometric questions and advice should go in the Econometric Discussions forum.

I have a series which consist of 109 observations and I am trying to test for stationary by using DF-GLS. Even though Eviews allows me to compute the GLS-detrended Dickey-Fuller (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 2002m01-2011m01.

scalar alpha=1-13.5/109series ygls=ipi-alpha*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=1-alpha ==> and make X11=1series t=@trend(2002m01,1)series x2t=t-alpha*(t-1)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 DF-GLS test.If it was the same, what I was going to do is just to make a Dickey-Fuller test -no constant and trend- on the residuals and then that would have been it.

First of all i have to thank you because i had problem with Elliot-Rothenberg-Stock (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 Dickey-Fuller(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.