version 10.0 *----------------------------------------- * Estimating a VECM * Load the data and create a time variable *----------------------------------------- log using chap13, replace use gdp, clear gen date = q(1970q1) + _n - 1 format %tq date tsset date *----------------------------------------- * Plot the series to identify constants * and trends. *----------------------------------------- tsline aus usa, scheme(sj) more tsline D.aus D.usa, scheme(sj) more *----------------------------------------- * Dickey-Fuller tests for stationarity *----------------------------------------- dfuller usa, regress trend lags(2) dfuller aus, regress trend lags(4) dfuller D.usa, lags(2) estat bgodfrey dfuller D.usa, lags(3) estat bgodfrey dfuller D.aus, lags(1) estat bgodfrey dfuller D.aus, lags(2) estat bgodfrey *----------------------------------------- * Estimate a Cointegrating relationship *----------------------------------------- regress aus usa, noconstant predict ehat, residual *----------------------------------------- * Engle Granger test *----------------------------------------- regress D.ehat L1.ehat, noconstant *----------------------------------------- * VECM *----------------------------------------- regress D.aus L1.ehat regress D.usa L1.ehat *----------------------------------------- * VAR Estimation *----------------------------------------- use growth, clear gen date = q(1960q1) + _n - 1 format %tq date tsset date *----------------------------------------- * Plot the series to identify constants * and trends. *----------------------------------------- tsline G P, scheme(sj) more tsline D.G D.P, scheme(sj) more *------------------------------------------- * A series of ADF regressions to select lag. * Then, use dfuller to get statistic and * critical values. *------------------------------------------- regress D.G L1.G date estat bgodfrey regress D.G L1.G L1.D.G date estat bgodfrey regress D.G L1.G L1.D.G L2.D.G date estat bgodfrey dfuller G, trend lags(2) *------------------------------------------- * A series of ADF regressions to select lag. * Then, use dfuller to get statistic and * critical values. *------------------------------------------- regress D.P L1.P date estat bgodfrey regress D.P L1.P L1.D.P date estat bgodfrey regress D.P L1.P L1.D.P L2.D.P date estat bgodfrey regress D.P L1.P L1.D.P L2.D.P L3.D.P date estat bgodfrey dfuller P, trend lags(3) *------------------------------------------- * Repeat for the differenced series * Note D.D.G = D2.G * We'll skip the lag search this time *------------------------------------------- dfuller D.G, lags(1) estat bgodfrey dfuller D.P, lags(2) estat bgodfrey *------------------------------------------- * Cointegration regression * Case 2: constant included * Engle-Granger test (Case 2) *------------------------------------------- regress G P predict ehat, residual regress D.ehat L.ehat *------------------------------------------- * VAR *------------------------------------------- varbasic D.G D.P, lags(1/1) step(12) more *------------------------------------------- * Test residuals for autocorrelation *------------------------------------------- varlmar *------------------------------------------- * IRFs and FEVDs * tables and graphs *------------------------------------------- irf table irf irf table fevd irf graph irf more irf graph fevd more irf table irf fevd, title("Combined IRF/FEVD for G and P") log close translate chap13.smcl chap13.txt, replace