110 likes | 220 Views
MACROECONOMETRICS. LAB 4 – VARs and VECMs. ROADMAP. Everything is by definition linked with everything? Estimating VARs Estimation and forecasting IRF VECM All about STATA . Dataset. Timing Quarterly data, Jan. 1995 – Dec. 2004 Data GDP Consumption GDP deflator M3
E N D
MACROECONOMETRICS LAB 4 – VARs and VECMs
ROADMAP • Everything is by definition linked with everything? • Estimating VARs • Estimation and forecasting • IRF • VECM • All about STATA
Dataset • Timing • Quarterly data, Jan. 1995 – Dec. 2004 • Data • GDP • Consumption • GDP deflator • M3 • Quarter dummies
STATA (1) • set memory 99m • set matsize 800 • Open downloaded file • Generate real variables: • Real GDP: gen rGDP=GDP/def_CPI • Real consumption • Generate logs (same way) • Log (realGDP) • Log (realconsumption) • Log (def_CPI) • Log (m3)
STATA (2) • Graphing • twoway (line lrpkb lrconsumption if date<q(2004.4)) (or alternatively, using the menu) • twoway (line lm3 ldef_CPI if date<q(2004.4)) (or alternatively, using the menu) • VARs • var lrpkb ldef_CPI lrconsumption lm3, exog(_q*)
STATA (3) • Diagnosis • Testing for number of lags • varsocvariables, maxlag(3) • Testing for VAR stability • varstable • Testing for Granger causality • vargranger • Testing for autocorrelation • varlmar
STATA (4) • Impulse-response functions • Starting • cap irf drop • Creating (Option #1) • varbasic lrpkb lrconsumption ldef_CPI lm3 if date<=q(2004q4), lags(1/3) • Creating (Option #2) • varirf create irf, set(irf, replace) • varirf graph irf, i(lrpkb) r(lrconsumption) / UNIQUE SHOCK/ AND • varirf graph oirf, i(lrpkb) r(lrconsumption) /ORTHOGONAL SHOCK/
STATA (5) • Forecasting • Computing • varfcast compute, step(8) dynamic(q(2005.1)) • Graphing • varfcast graph lrconsumption ldef_CPI lm3 lrpkb
STATA (6) • No. of cointegrating relations (Johansen trace test for the rank) • vecrank lrconsumption ldef_CPI lrpkb lm3, sindicators(_q*) lags(3)
STATA (7) • VECM • vec lrconsumption ldef_CPI lrpkb lm3, rank(3) sindicators(_q*) lags(2) REMEMBER: Cointegrating vectors not interpretable • Testing for stability • vecstable • Testing for autocorrelation • veclmar
STATA (8) • Testing for long run relationships (examples the same as in the lecture) • constraint 1 [_ce1]lrconsumption=-1 • constraint 2 [_ce1]ldef_CPI • constraint 3 [_ce1]lm3 • constraint 4 [_ce2]lm3=-1 • constraint 5 [_ce2]lrconsumption • constraint 6 [_ce2]ldef_CPI=1 • constraint 7 [_ce2]lrpkb=1 • vec lrconsumption ldef_CPI lrpkb lm3, rank(2) sindicators(_q*) lags(3) dforce bconstraints(1/7)