*! version 3.0.0 *! coint -- perform single-equation cointegration tests using the augmented *! Dickey-Fuller test. *! Sean Becketti, April 1991. program define coint version 3.0 local varlist "req ex min(2)" local options "Nlags(int 4) noFindlag Detail Trend Vector *" parse "`*'" if (`nlags'<0) { di in red "nlags() must be >= 0" exit 198 } /* Estimate the cointegrating regression, grab the residuals, and run the Dickey-Fuller test on them. */ if "`trend'"!="" { tempvar trend qui gen long `trend' = _n } qui reg `varlist' `trend' if "`vector'"!="" {noi reg} /* Echo the cointegrating vector */ tempvar resid qui predict `resid', resid dickey `resid', nlags(`nlags') `findlag' `detail' `options' end