* * ARCH-GARCH examples starting page 369 * open data byd.dat data(format=free,org=columns) 1 500 r * linreg r # constant * set e = %resids * * LM regression for ARCH test * set esq = e^2 linreg esq # constant esq{1} * * This is slightly different from the result in the text as it uses the full * precision of the R-squared. * cdf(title="ARCH test") chisqr %trsquared 1 * * The ARCHTEST procedure can handle the entire test given the residuals. The * FORM=LM asks for the form given in the text, rather than an F test. * @archtest(lags=1,form=lm) e * * Estimating an ARCH model. This is done using the GARCH instruction. The number * of lagged squared residual terms is given by the Q option. Because the * instruction can be used for several series at once, you put the estimation range * first (here, just the / for the full range), followed by the series. * * One thing to note is that the estimated parameters and (particularly) the * standard errors can be somewhat different. All of these models are estimated * using iterative methods and different software use different algorithms to find * the "best" set of parameters. While the parameter values are generally quite * close, the standard errors are often quite different. Choice of algorithm has * more of an effect on the latter than the former. * garch(q=1) / r * * Estimating the GARCH model. The number of lagged variance terms is indicating * with the P option. * garch(p=1,q=1,hseries=hgarch) / r * * Estimating the model with asymmetry * garch(p=1,q=1,asymm,hseries=htgarch) / r * * Estimating the model with asymmetry and "M" effects. %garchv is a series used * internally by GARCH to represent the variance. The REG(ressors) option indicates * that the mean model takes the form of a regression, rather than just a simple * mean. * garch(p=1,q=1,reg,asymmetric,hseries=htgarchm) / r # constant %garchv * * The TABLE instruction can be used to determine the maximum value taken by the * three variance series. Graphing all of them on a common scale is a good idea. * table(noprint) / hgarch htgarch htgarchm spgraph(vfields=3,footer="Figure 14.7 Estimated variances of ARCH models") graph(hlabel="(a) GARCH(1,1)",max=%maximum) # hgarch graph(hlabel="(b) T-GARCH(1,1)",max=%maximum) # htgarch graph(hlabel="(c) GARCH-in-mean",max=%maximum) # htgarchm spgraph(done)