Statistics and Algorithms / GARCH Models / GARCH Models (Univariate) / UV GARCH: Saving Residuals and Variances |
For a univariate model, you can get the residuals and series of variance estimates using the RESIDS and HSERIES options. (Different options are needed for multivariate models). The following, for instance, will produce in the series USTD the standardized residuals (residuals divided by the model's estimate of the standard deviation) from a GARCH(1,1):
garch(p=1,q=1,resids=u,hseries=h) / dlogdm
set ustd gstart gend = u/sqrt(h)
GARCH also defines the %RESIDS series when you estimate a univariate model.
HADJUST option
If you need an “M” term other than the current variance, you can use the combination of HSERIES and HADJUST options to generate a new series. You first have to initialize that new series (either to zero or perhaps to a series generated from a preliminary GARCH estimate), and use HADJUST to set the current value of that series. For instance, the following uses the square root of the variance which is generated “on the fly” by the GARCH instruction by taking the square root of current HS (the series into which the variances are being saved by HSERIES) and saving it into the current entry of the series SQRTH:
set sqrth = 0.0
garch(p=1,q=1,hseries=hs,hadjust=(sqrth=sqrt(hs)),$
regressors) / dlogdm
# constant sqrth
Copyright © 2025 Thomas A. Doan