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