EGTESTRESIDS - Engle-Granger Cointegration Test
Attached is a revised version of the @EGTESTRESIDS procedure for doing the Engle-Granger cointegration test on the residuals from a preliminary regression. This includes options for automatic lag length selection, with options similar to the ones that we've used in other procedures. The default for the new METHOD option is METHOD=INPUT, so it will work without change for existing programs. The companion procedure @EGTEST (viewtopic.php?f=7&t=1560) is similar but does the preliminary regression first.
Options for Selecting Lags
LAGS=number of additional lags [0]
MAXLAGS=maximum number of additional lags to consider [number of observations^.25]
You can use either of these to select either the (maximum) number of additional lags. If you don't use either option, the LAGS default of 0 will be used for METHOD=INPUT and the MAXLAGS default will be used for the others.
METHOD=[INPUT]/AIC/BIC/HQ/TTEST/GTOS
METHOD=INPUT uses the input number of LAGS only. METHOD=AIC/BIC/HQ tests the D-F regressions for everything from 0 to LAGS/MAXLAGS and chooses the minimizer for the chosen criterion. METHOD=TTEST/GTOS starts with the full set of lags and deletes lags as long as the final one has a marginal significance level less than the cutoff given by the SIGNIF option. (GTOS is short for General-TO-Specific).
SIGNIF=cutoff significance level for METHOD=TTEST or GTOS[.10]
Other Options
NVAR=number of endogenous variables in the cointegrating regression, counting the dependent variable [2]
DET=NONE/[CONSTANT]/TREND
Choose what deterministic components were included in the original regression. This changes the critical values.
[PRINT]/NOPRINT
TITLE=Title for output ["Engle-Granger Cointegration Test"]
Example
Options for Selecting Lags
LAGS=number of additional lags [0]
MAXLAGS=maximum number of additional lags to consider [number of observations^.25]
You can use either of these to select either the (maximum) number of additional lags. If you don't use either option, the LAGS default of 0 will be used for METHOD=INPUT and the MAXLAGS default will be used for the others.
METHOD=[INPUT]/AIC/BIC/HQ/TTEST/GTOS
METHOD=INPUT uses the input number of LAGS only. METHOD=AIC/BIC/HQ tests the D-F regressions for everything from 0 to LAGS/MAXLAGS and chooses the minimizer for the chosen criterion. METHOD=TTEST/GTOS starts with the full set of lags and deletes lags as long as the final one has a marginal significance level less than the cutoff given by the SIGNIF option. (GTOS is short for General-TO-Specific).
SIGNIF=cutoff significance level for METHOD=TTEST or GTOS[.10]
Other Options
NVAR=number of endogenous variables in the cointegrating regression, counting the dependent variable [2]
DET=NONE/[CONSTANT]/TREND
Choose what deterministic components were included in the original regression. This changes the critical values.
[PRINT]/NOPRINT
TITLE=Title for output ["Engle-Granger Cointegration Test"]
Example
- Code: Select all
*
* Enders, Applied Econometric Time Series, 3rd edition
* Example from Section 6.6, pp 382-385
* Cointegration analysis of PPP. This carries out the analysis over the
* full sample on the coint_ppp.xls data file.
*
open data coint_ppp.xls
calendar(q) 1973:1
data(format=xls,org=columns) 1973:01 2008:02 ex_ca ex_ja ex_uk p_ca p_ja p_uk p_us p_fr p_sw ex_fr ex_sw
*
* Generate logs of all the series (which will be named logex_ca etc.)
*
dofor s = ex_ca to ex_sw
set %s("log"+%l(s)) = log(s{0})
end dofor s
*
* Compute the dollar values of foreign prices
*
set logf_ca = logp_ca-logex_ca
set logf_ja = logp_ja-logex_ja
set logf_uk = logp_uk-logex_uk
*
* Do ADF tests on the US price level and the dollar-denomimated foreign
* price level.
*
@dfunit(lags=2) logp_us
@dfunit(lags=2) logf_ca
@dfunit(lags=2) logf_ja
@dfunit(lags=2) logf_uk
*
* Do E-G regressions on restricted form (expecting unit slope
* coefficients).
*
linreg logf_ja / resids
# constant logp_us
@egtestresids(nvar=2,maxlags=8,method=aic,title="EG test for PPP in Japan") resids
linreg logf_ca / resids
# constant logp_us
@egtestresids(nvar=2,maxlags=8,method=aic,title="EG test for PPP in Canada") resids
linreg logf_uk / resids
# constant logp_us
@egtestresids(nvar=2,maxlags=8,method=aic,title="EG test for PPP in UK") resids
*
* Do E-G regressions using both price indices (expecting 1,-1 slope
* coefficients under PPP).
*
linreg logex_ja / resids
# constant logp_ja logp_us
@egtestresids(nvar=3,maxlags=8,method=aic,title="EG test for Cointegration in Japan/US") resids
*
linreg logex_ca / resids
# constant logp_ca logp_us
@egtestresids(nvar=3,maxlags=8,method=aic,title="EG test for Cointegration in Canada/US") resids
*
linreg logex_uk / resids
# constant logp_uk logp_us
@egtestresids(nvar=3,maxlags=8,method=aic,title="EG test for Cointegration in UK/US") resids