* * Example of GARCH models from chapter 13, section 5, * pp 397-405 * open data return_nyse.dat data(format=prn,org=columns) 1 3531 r * @histogram(footer="Figure 13.2 NYSE Returns: Histogram and Diagnostic Statistics",stats) r 1 3461 @acf(footer="Figure 13.3 NYSE Returns: Correlogram",number=30) r 1 3461 * set rsq = r**2 graph(footer="Figure 13.4 Squared NYSE Returns: Time Series Plot") # rsq * @acf(footer="Figure 13.5 Squared NYSE Returns: Correlogram",number=30) rsq 1 3461 * * Linear regression of squared returns on its lags * linreg rsq * 3461 # constant rsq{1 to 5} * * ARCH(5) model. Because the GARCH instruction is designed to handle both * univariate and multivariate models, its syntax has parameters in the order * GARCH( options ) start end series or list of series * * There's a slight difference in the results because of a different treatment in * the pre-sample values for the lagged squared residuals. * garch(p=0,q=5,resids=u,hseries=h) * 3461 r set ustd = u/sqrt(h) * @regcorrs(number=30) ustd * garch(p=1,q=1,resids=u,hseries=h) * 3461 r set ustd = u/sqrt(h) @regcorrs(number=30) ustd * set garchsd = sqrt(h) graph(footer="Figure 13.8 NYSE Returns: Estimated Conditional S.D. GARCH(1,1)",min=0.0) # garchsd * * Exponential smoothing of the squared returns * esmooth(alpha=.05,smoothed=esvar) rsq 1 3461 set essd = sqrt(esvar) graph(footer="Figure 13.9 NYSE Returns: Estimated Conditional S.D. Exponential Smoothing",min=0.0) # essd * * Do forecasts of the GARCH variance * set uu = u**2 compute vc=%beta(2),vb=%beta(4),va=%beta(3) frml hfrml h = vc+vb*h{1}+va*uu{1} frml uufrml uu = h group garchmod hfrml>>h uufrml>>uu forecast(model=garchmod,print) * (4000-3461) 3462 * * Transform into standard deviations * set garchsd * 4000 = sqrt(h) * * Figure out the steady state standard deviation * compute sssd=sqrt(vc/(1-va-vb)) * graph(footer="GARCH(1,1) Model: Conditional Standard Deviation, History and Forecast") 2 # garchsd 3300 3461 # garchsd 3462 3531 graph(footer="GARCH(1,1) Model: Conditional Standard Deviation, Extended History and Forecast",$ vgrid=sssd) 2 # garchsd 3000 3461 # garchsd 3462 4000