* * Enders, Applied Econometric Time Series, 4th edition * Example from User's Guide Section 3.10, pp 158-165 * GARCH Applied to NYSE Returns * cal(d) 2000:1:3 all 2012:7:16 open data nysereturns.xlsx data(org=obs,format=xlsx) * graph(footer="Figure 3.3: Percentage Change in the NYSE US 100: (Jan 4, 2000 - July 16, 2012)",\$ vlabel="Percentage Change") # rate * * Standardize to mean zero, variance 1 * diff(standardize) rate / stdrate @histogram(distrib=normal,maxgrid=50,footer="standardized rates") stdrate * density(smooth=2.0) stdrate / xdensity fdensity scatter(style=line) # xdensity fdensity set normalf = %density(xdensity) * * This is a t(3) standardized to a variance of 1.0. (The variance of * non-standardized t(nu) is nu/(nu-2), which is 3 for nu=3). * set tf = %tdensity(xdensity*sqrt(3.0),3.0)*sqrt(3.0) scatter(footer="Figure 3.13 Returns of the NYSE Index of 100 Stocks",style=line,\$ key=below,klabels=||"Actual returns","Normal density","t density"||) 3 # xdensity fdensity # xdensity normalf # xdensity tf * @bjident(report,qstats) rate @bjautofit(pmax=2,qmax=2,crit=aic) rate @bjautofit(pmax=2,qmax=2,crit=bic) rate * * Use the AR(2) favored by AIC * boxjenk(const,ar=2) rate set usqr = %resids^2 @regcorrs(title="Squared residuals from MA(1)",report,number=20) usqr @archtest(lags=5) %resids * * GARCH with normal distribution * garch(reg,p=1,q=1) / rate # constant rate{1 2} * * GARCH with t distribution * garch(reg,p=1,q=1,dist=t) / rate # constant rate{1 2} * * I-GARCH with t distribution * garch(reg,p=1,q=1,i=drift,dist=t) / rate # constant rate{1 2} * * I-GARCH(1,1)-M with t distribution * garch(reg,p=1,q=1,i=drift,dist=t) / rate # constant rate{1 2} %garchv * * Further analysis with chosen model (IGARCH(1,1)) with normal * garch(reg,p=1,q=1,i=drift,dist=t,hseries=hh) / rate # constant rate{1 2} * set stdu = %resids/sqrt(hh) @regcorrs(report,qstats,number=15,title="Standardized Residuals from IGARCH") stdu set stdusq = stdu^2 @regcorrs(report,qstats,number=15,title="Squared Standardized Residuals from IGARCH") stdusq @archtest(lags=2) stdu * * Test for leverage (squared standardized residuals on unsquared * standardized residuals). * linreg stdusq # constant stdu{1 2} exclude(title="Test for leverage") # stdu{1 2} * * Engle-Ng sign test * set dsign = stdu<0 linreg stdusq # constant dsign{1 2 3} exclude(title="Engle-Ng test") # dsign{1 2 3} * set dsignu = dsign*stdu set dsignpu = (1-dsign)*stdu linreg stdusq # constant dsign{1} dsignu{1} dsignpu{1} * * Asymmetric GARCH * garch(reg,asymmetric,distrib=t) / rate # constant rate{1 2} * * Asymmetrical EGARCH * garch(reg,exp,asymmetric,distrib=t,hseries=hh) / rate # constant rate{1 2} * * Diagnostics * set stdu = %resids/sqrt(hh) @regcorrs(number=15,report,title="Standardized Residuals from EGARCH") stdu set stdusq = stdu^2 @regcorrs(number=15,report,title="Squared Standardized Residuals from EGARCH") stdusq * graph(footer="Figure 3.15 Estimated Variance") # hh