*==============================================================================* * Advanced Applied Econometrics * Jakub Muck * Exercise 14 * importing data clear all use "http://e-web.sgh.waw.pl/jmuck/AAE/Datasets/USPhillipsCurve.dta" * setting dataset as time series sort year quarter gen t=_n * Aleternatively: * egen t=group(year quarter) tsset t * Calaculate annual inflation gen infl_a=(CPI-L4.CPI)/L4.CPI*100 * Calaculate annual inflation with the logarythmic growth rate gen cpi=ln(CPI) gen infl_a2=(cpi-L4.cpi)*100 *tsline infl_a* *(ii) OLS estimates reg infl_a UNRATE estimates store ols *(iii) Residuals predict ehat, residuals tsline ehat scatter ehat L.ehat *(iv) Test * Autocorrelation and Partial autocorrelation functions ac ehat pac ehat * Breusch-Godfrey test reg infl_a UNRATE estat bgodfrey, lag(1/4) * (vi) Newey-West standard eeros newey infl_a UNRATE, lag(4) estimates store newey_west * (vii) Cochrane-Orcutt/Prais-Winsten/FGLS estimation * step-by-step reg ehat L.ehat, nocons gen rho=_b[L.ehat] * Loop for quasi-differencing foreach var in infl_a UNRATE{ gen `var'_star=`var'-rho*L.`var' } reg infl_a_star UNRATE_star * Built-in command for iterative estimator prais infl_a UNRATE estimates store fgls * (viii) Summary of results estimates table ols newey_west fgls, b se p