Introduction
Securities do not move like a random walk. We have seen that there is
serial correlation (positive in the short-run and
negative in the long-run). The variance of the returns is not
constant.
require(quantmod)
getSymbols('BAC')
## [1] "BAC"
plot(ROC(Cl(BAC)))

As we know from experience and as can be seen from plot of BAC
returns, there are periods of calm and there are periods of
volatility.
We can compare this to the returns of a real random walk that we
crated last week.
ry = rnorm(100)
plot(ry, type = 'l')

In this case we categorise periods into different regimes: often calm
and crisis. During the period of calm we may have relatively large
returns with a small standard deviation while the periods of crisis will
be lower (possibly negative) returns with much larger standard
deviation. The crisis may also be more prone to non-symmetric
distribution.
This will model the general autoregressive conditional
hetroskedasticity. The two main authors here are Engle (1982) and Bollerslev (1986). It is a more general form of
the ARCH (Autoregressive hetroskedasticity) of the form:
\[y_t = \mu + \sum_{i=1}^q \alpha_i
\varepsilon_{t - i}^2 + \sum_{i = 1}^p \beta_i
\sigma_{t-i}^2\]
where \(\mu\) includes external
regressors and auto-regressive elements to remove serial correlation.
\(P\) is the persistence calculated
as:
\[P = \sum_{i = 1}^q \alpha_i +
\sum_{i=1}^p \beta_i\]
This must be less than 1 outside the IGARCH model and measures the
persistence of volatility shocks. The other model constraints are:
\[1 > \alpha > 0\] \[1 > \beta > 0 \]
GARCH
We will use the rugarch model. This is quite complex and
sophisticated but it can be simplified as two processes:
Create the specification with the ugarchspec
function. This allows you to model different types of GARCH, specify the
underlying ARIMA model that will remove serial correlation and any
seasonal effects and provide a lot of other customisation such as. You
can mostly use the defaults to start.
Fit the chosen GARCH model with ugarchfit. This will
use maximum-likelihood to estimate the chosen
model.
Main GARCH models
There are four main GARCH models (though many other variations and
subtle adjustments that can be made):
The basic GARCH (1,1) model has one
autoregresssive (ARCH) term and one moving average (GARCH) component.
This means that p and q equal one in Equation 1.
EGARCH is exponential GARCH and allows for
asymmetric effects between positive and negative effective. This is also
called the leverage effect as a result of the way that leverage
positions have to be unwound in a downturn. Nelson (1990)
IGARCH is integrated GARCH where the
autoregressive and moving average components sum to unity and any
innovation in variance is persistent. This is where the \(\alpha\) and \(\beta\) coefficients sum to one.
GJR GARCH Glosten,
Jagannathan, and Runkle (1993) also models asymmetric effects
with \(\gamma\) representing an
leverage term that takes 1 for positive values and zero
for negative values.
Asymmetric power ARCH Ding, Granger, and Engle (1993) allows for both
leverage and power effects.
Example
A plan to deal with the many possibilities that are available is to
use the basic GARCH model, carry out the diagnostic tests and then see
if they suggest an adjustment to this standard way of addressing
conditional hetroskedasticity. This may show that you need additional
lags, asymmetric effects or non-normal distributions.
From the rugarch package.
require(rugarch)
# start with the standard specification
spec <- ugarchspec()
show(spec)
##
## *---------------------------------*
## * GARCH Model Spec *
## *---------------------------------*
##
## Conditional Variance Dynamics
## ------------------------------------
## GARCH Model : sGARCH(1,1)
## Variance Targeting : FALSE
##
## Conditional Mean Dynamics
## ------------------------------------
## Mean Model : ARFIMA(1,0,1)
## Include Mean : TRUE
## GARCH-in-Mean : FALSE
##
## Conditional Distribution
## ------------------------------------
## Distribution : norm
## Includes Skew : FALSE
## Includes Shape : FALSE
## Includes Lambda : FALSE
# use S&P 500 return data that comes with the package
data(sp500ret)
# fit a standard model with the default specifications
fit <- ugarchfit(spec = spec, data = sp500ret)
show(fit)
##
## *---------------------------------*
## * GARCH Model Fit *
## *---------------------------------*
##
## Conditional Variance Dynamics
## -----------------------------------
## GARCH Model : sGARCH(1,1)
## Mean Model : ARFIMA(1,0,1)
## Distribution : norm
##
## Optimal Parameters
## ------------------------------------
## Estimate Std. Error t value Pr(>|t|)
## mu 0.000523 0.000087 5.9926 0.00000
## ar1 0.870077 0.072183 12.0538 0.00000
## ma1 -0.897302 0.064617 -13.8865 0.00000
## omega 0.000001 0.000001 1.3971 0.16239
## alpha1 0.087711 0.013658 6.4221 0.00000
## beta1 0.904940 0.013704 66.0350 0.00000
##
## Robust Standard Errors:
## Estimate Std. Error t value Pr(>|t|)
## mu 0.000523 0.000129 4.038545 0.000054
## ar1 0.870077 0.088201 9.864737 0.000000
## ma1 -0.897302 0.080362 -11.165757 0.000000
## omega 0.000001 0.000014 0.094161 0.924982
## alpha1 0.087711 0.185043 0.474004 0.635497
## beta1 0.904940 0.190544 4.749240 0.000002
##
## LogLikelihood : 17902.41
##
## Information Criteria
## ------------------------------------
##
## Akaike -6.4807
## Bayes -6.4735
## Shibata -6.4807
## Hannan-Quinn -6.4782
##
## Weighted Ljung-Box Test on Standardized Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 5.553 1.845e-02
## Lag[2*(p+q)+(p+q)-1][5] 6.444 1.225e-05
## Lag[4*(p+q)+(p+q)-1][9] 7.200 1.100e-01
## d.o.f=2
## H0 : No serial correlation
##
## Weighted Ljung-Box Test on Standardized Squared Residuals
## ------------------------------------
## statistic p-value
## Lag[1] 1.105 0.2933
## Lag[2*(p+q)+(p+q)-1][5] 1.499 0.7401
## Lag[4*(p+q)+(p+q)-1][9] 1.958 0.9100
## d.o.f=2
##
## Weighted ARCH LM Tests
## ------------------------------------
## Statistic Shape Scale P-Value
## ARCH Lag[3] 0.01981 0.500 2.000 0.8881
## ARCH Lag[5] 0.17496 1.440 1.667 0.9713
## ARCH Lag[7] 0.53652 2.315 1.543 0.9750
##
## Nyblom stability test
## ------------------------------------
## Joint Statistic: 174.2382
## Individual Statistics:
## mu 0.2054
## ar1 0.1482
## ma1 0.1051
## omega 21.3506
## alpha1 0.1346
## beta1 0.1134
##
## Asymptotic Critical Values (10% 5% 1%)
## Joint Statistic: 1.49 1.68 2.12
## Individual Statistic: 0.35 0.47 0.75
##
## Sign Bias Test
## ------------------------------------
## t-value prob sig
## Sign Bias 0.4294 6.676e-01
## Negative Sign Bias 2.9494 3.198e-03 ***
## Positive Sign Bias 2.3922 1.678e-02 **
## Joint Effect 28.9851 2.256e-06 ***
##
##
## Adjusted Pearson Goodness-of-Fit Test:
## ------------------------------------
## group statistic p-value(g-1)
## 1 20 178.6 5.738e-28
## 2 30 188.3 2.924e-25
## 3 40 217.8 1.084e-26
## 4 50 227.7 7.646e-25
##
##
## Elapsed time : 0.9866514
Diagnostic tests
In addition to the estimates of the coefficient estimates, the
ugarchfit function will return a number of diagnostics. As
usual, these are based on the requirement that the remaining error
represented by residuals from the estimated model have a constant mean
and variance and no serial correlation.
- Log-Likelihood ratios
- AIC, BIC, HQIC and SIC tests of fit (these will
deflate the Log-Likelihood for additional variables).
- Autoregressive and Arch tests of residuals. Null
hypothesis is that there is no serial correlation or hetroskedasticity
in the residuals.
- Nybold stability tests the stability of the
estimate coefficients. Null is that the parameters are constant.
- The signbias tests will assess asymmetric GARCH
effects. Null is that there are no effects.
- Goodness of fit (gof) will compare the density of the residuals with
those of the specification.
- Adjusted Pearson Goodness of Fit compares the
distribution of the residuals with the theoretical distribution. The
null is that the theoretical and null are identical.
Bibliography
Bollerslev, Tim. 1986. “Generalized Autoregressive Conditional
Hetroskedasticity.” Journal of Econometrics 31: 307–27.
Ding, Z, C. W. J. Granger, and R. F. Engle. 1993. “A Long Memory
Property of Stock Market Returns and a New Model.” Journal of
Empirical Finance 1: 83–106.
Engle, Robert F. 1982. “Autoregressive Conditional Conditional
Hetroscecastisity with Estimates of the Variance of United Kingdon
Inflation.” Econometrica 50 (4): 987–1007.
Glosten, L. R., R. Jagannathan, and D. E. Runkle. 1993. “On the
Relation Between the Expected Value and the Volatility of the Nominal
Excess Return on Stocks.” Journal of Finance 48 (5):
1779–1801.
Nelson, Daniel B. 1990. “Stationarity and Persistence in the GARCH
(1,1) Model.” Econometric Theory 6: 318–34.