# Cointegration test in Stata

I am doing a Engle-Granger test for cointegration and I am unsure about some commands.

"Cointegration and the ECM" (document) from learneconometric.com says I should use:

regress b f
predict ehat, residual
regress D.ehat L.ehat L.D.ehat, noconstant


However, "Time series" (document from Princeton Uni) says I should use:

regress b f
predict ehat, resid
dfuller ehat, lags(10)


So I am unsure about the last commands here. Should I use regress D.ehat L.ehat L.D.ehat, noconstant or dfuller ehat, lags(10) and what is the difference here? Also, how many "lags" should I include for the Dickey Fuller test?

Do the last one, the first one is just the same thing but you will not be using the in-built adf function. The second one does it better and you have a choice of including lagged differences to control for possible autocorrelation. If your data is monthly, give it a lag order of 12.

In STATA I would actually recommend the package egranger

findit egranger


and to install it:

ssc inst egranger


Regarding the DF-test, I usually use another package, dfao. This one lets me use an information criterion, such as HQIC, AIC or SBIC, to choose the optimal lag length. Again:

findit dfao


To install it:

ssc inst dfao


My default specification for the DF is

dfao varname, lltc(sc) noao notr


where the options specify, in order: use the Schwarz criterion to choose the lag length; do not test for additive outliers [i.e. work like normal DF test]; and do not add a trend automatically.