6. Conditional heteroskedasticity and ARCH(p) models
Level 9: Time Series - ARIMA and GARCH
We now reach the part that really matters in finance. Everything so far models the conditional mean of the series. Now we are going to model its conditional variance.
A set of random variables is heteroskedastic if there are subgroups within the set whose variance differs from that of the rest. The main motivation for studying conditional heteroskedasticity in finance is the volatility of asset returns.
The economic mechanism the professor describes is concrete: in equities, an increase in variance can be correlated with a subsequent increase in variance. On a day when the market falls sharply, automatic risk management orders are triggered in long-only portfolios; those sales cause further price falls in those same portfolios, generating significant downside volatility.
These liquidation periods produce heteroskedasticity that is serially correlated and therefore conditional on periods of elevated variance. We call such series conditionally heteroskedastic.
And here is the most treacherous aspect: the ACF of a series with changing volatility can look exactly like that of stationary white noise, even though the series is beyond doubt non-stationary because its variance is not constant over time. If you only look at the ACF of the returns, you see nothing. The solution is to look at the ACF of the squared returns.
To incorporate conditional heteroskedasticity we build a model that applies an autoregressive process to the variance itself, using past values of the variance. That is the basis of the autoregressive conditional heteroskedasticity model, or ARCH.
An ARCH(p) can be understood as an AR(p) applied to the variance of a time series:
# ARCH(p), in words and as code:
#
# variance at t = alpha_0 + alpha_1*(e[t-1]**2) + ... + alpha_p*(e[t-p]**2)
#
# and the observed series is:
# e[t] = w[t] * sqrt(alpha_0 + alpha_1*e[t-1]**2 + ... + alpha_p*e[t-p]**2)
#
# For ARCH(1):
# e[t] = w[t] * sqrt(alpha_0 + alpha_1*e[t-1]**2)Simulating an ARCH(1):
np.random.seed(13)
a0 = 2
a1 = 0.5
y = w = np.random.normal(size=1000)
for t in range(len(y)):
y[t] = w[t] * np.sqrt(a0 + a1 * y[t-1]**2)
tsplot(y, lags=30) # looks like pure white noise
tsplot(y**2, lags=30) # the ACF and PACF of the square are significant at lag 1This is the central visual lesson of the module: the series looks like white noise, but when you plot its square, the ACF and the PACF show significance at lag 1, which indicates that an AR(1) on the variance may be appropriate.
When should an ARCH(p) be applied? Just as we decided the order of an AR by looking at the decay of the ACF of the series, we apply the same logic to the squared residuals. If we can fit an AR(p) to those squared residuals, we have an indication that an ARCH(p) process is appropriate.
Three conditions that are not optional:
- The ARCH(p) should only be applied to a series to which an adequate model has already been fitted, good enough for the residuals to look like discrete white noise.
- Since the diagnostic consists of squaring the residuals and examining their ACF, you must make sure that the mean of the residuals is zero.
- ARCH should only be applied to series with no trend and no seasonal effects, that is, with no evident serial correlation. ARIMA is often applied first, and at that point ARCH can be a good fit.
That ordering (first the mean with ARIMA, then the variance with ARCH or GARCH) is the skeleton of the strategy in the final module.
To go deeper into this lesson
- S&P 500in the glossary
- Walk-forward testingin the glossary
- What the S&P 500 is: how it is built, who decides and how you invest in itguide