************************************************************** ******CHAPTERS 19-20. TIME SERIES ANALYSIS OF GDP AND M2****** ************************************************************** * cal 1947:1 1 4 all 2004:1 * open data c:\gauss35\classes\Econ5350\Data\m2sl.xls data(format=xls,compact=average,org=cols) / m2 * open data c:\gauss35\classes\Econ5350\Data\gdpc1.xls data(format=xls,org=cols) / gdp time * ***** TRANSFORMATIONS ****** * compute begsmpl = 1959:1 compute endsmpl = 2003:4 log gdp log m2 set gdpdiff begsmpl+1 endsmpl = gdp - gdp{1} set m2diff begsmpl+1 endsmpl = m2 - m2{1} smpl begsmpl+1 endsmpl * ************************** ***** UNIT ROOT TEST ***** ************************** * linreg gdpdiff begsmpl+1 endsmpl # constant time gdp{1} * linreg m2diff begsmpl+1 endsmpl # constant time m2{1} * ********************************* ***** VECTOR AUTOREGRESSION ***** ********************************* * ***** OLS ESTIMATION AND GRANGER CAUSALITY ***** * system 1 to 2 variables gdpdiff m2diff lags 1 to 4 det constant end(system) estimate(print,outsigma=v) * ***** VARIANCE DECOMPOSITIONS ***** * errors(print) 2 16 v # 1 # 2 * ***** GRAPH IMPULSE RESPONSE FUNCTIONS ***** * impulse(noprint) 2 16 1 v # 1 resp11 # 2 resp21 * impulse(noprint) 2 16 2 v # 1 resp12 # 2 resp22 * spgraph(hfields=2,vfields=2,header="IMPULSE RESPONSE FUNCTIONS") graph(number=0,header="GDP Response to GDP",hlabel="Lags") 1 # resp11 1 16 * graph(number=0,header="GDP Response to M2",hlabel="Lags") 1 # resp12 1 16 * graph(number=0,header="M2 Response to GDP",hlabel="Lags") 1 # resp21 1 16 * graph(number=0,header="M2 Response to M2",hlabel="Lags") 1 # resp22 1 16 spgraph(done) * *********************** ***** ARCH IN GDP ***** *********************** * dec vect b(2) nonlin(parmset=meanparms) b nonlin(parmset=archparms) vc vb frml resid = gdpdiff-b(1)-b(2)*m2diff{1} frml hf = vc+vb*resid(t-1)**2 frml archlogl = (vcv=hf(t)), -0.5*(log(vcv)+resid(t)**2/vcv) linreg(noprint) gdpdiff # constant m2diff{1} compute b=%beta,vc=%seesq,vb=0.5 maximize(parmset=meanparms+archparms,method=bfgs,robusterrors) archlogl 2 *