Skip to content
All library documents

Interpreting and Evaluating GARCH Volatility Forecasts

Article Quant Q&A · Author: KOB

Summary

The document presents an attempted out-of-sample volatility forecast for a stock using a GARCH model fitted to percentage returns. It forecasts across a multi-day horizon and compares the output with annualized rolling standard deviation calculated from realized returns. The author reports poor-looking results and asks how to interpret forecast variance, retrieve fitted training-period values, assess the realized volatility calculation, and choose the model orders.

The code and questions frame practical issues in volatility forecasting, but the document contains no answers or reported evaluation beyond the visual impression that the forecasts are poor. It does not establish whether forecast variance should be square-rooted for comparison, whether the realized measure aligns with the forecast horizon, or whether alternative model orders would improve performance. Those points remain unresolved, and the example alone is not evidence that GARCH is unsuitable.

Key ideas

  • The example fits a GARCH model to stock percentage returns and produces a multi-step variance forecast.
  • It compares the forecast with annualized rolling standard deviation from realized returns.
  • The document asks whether variance forecasts require transformation before interpreting them as volatility.
  • It also asks how to obtain fitted values and select GARCH model orders.
  • No answers or formal accuracy results are provided.

Tags

Full text
# Poor results forecasting stock price volatility using Python's GARCH model


# Poor results forecasting stock price volatility using Python's GARCH model












As far as I understand, forecasting stock price volatility should be more achievable than forecasting absolute prices or returns. It seems as though GARCH models are the traditional and most widely used for forecasting volatility. I have attempted to implement a GARCH model to make a multistep ahead volatility forecast in Python:

```
import utils
import numpy as np
import arch
import matplotlib.pyplot as plt

ticker = 'AAPL'
forecast_horizon = 30

# RETRIEVE 5 YEAR IEX TRADING PRICES THROUGH CUSTOM API
prices = utils.dw.get(ticker, source='iex', iex_range='5y')
df = prices[['date', 'close']]

# RETURNS
# df['returns'] = np.log(df['close']).diff()
df['returns'] = df['close'].pct_change()
df.dropna(inplace=True)
df.reset_index(inplace=True, drop=True)

# FIT GARCH
garch = arch.arch_model(df['returns'][:-forecast_horizon])
fitted_garch = garch.fit(disp=False)

print(fitted_garch.summary())

# FUTURE FORECAST
forecast = fitted_garch.forecast(horizon=forecast_horizon).residual_variance.values[-1]

# CALCULATE ACTUAL VOLATILITY
df['monthly_stddev'] = df['returns'].rolling(21).std()
df.dropna(inplace=True)
df.reset_index(inplace=True, drop=True)
df['volatility'] = df['monthly_stddev'] * np.sqrt(252)
df.drop('monthly_stddev', axis=1, inplace=True)

# PLOT ACTUAL VS FORECASTED VOLATILITY
plt.plot(df['volatility'][-forecast_horizon:].reset_index(drop=True), label='Actual')
plt.plot(forecast, label='Forecast')
plt.legend()
plt.show()
```

The results are not very good at all, but I think it is mainly down to my misunderstanding of how the GARCH model works, and what it outputs.

My questions are:

- Given that we input returns into the GARCH model, what is the output of its forecast (`fitted_model.forecast().variance` / `fitted_model.forecast().residual_variance`? Can this output be interpreted directly as the volatility forecast? Or does some transformation need to be applied to this forecast to obtain the volatility values?

- Is there any way to retrieve the GARCH model's fitted values on the training set? I would like to not only plot the model's forecast for the out-of-sample test set of the final 30 days, but also plot the learnt values for the entire training set to get an idea of how well the model learnt the training data.

- Is my calculation from actual returns to actual volatility correct for comparing it to the GARCH model's volatility forecast to determine how accurate the model's forecast is?

- Is it suitable to use only GARCH(1, 1) here? Should I be trying other values for p and q? I saw somewhere where auto_arima was used to determine p and q, and these were then set in the GARCH model.

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.