Effect of mean model on volatility predictions
In practice, returns and volatility are modeled in separate processes. Typically the mean assumptions influence predicted returns, but have a minor effect on the volatility estimations.
In this exercise, you will examine the impact of GARCH model mean assumptions on volatility estimations by comparing two GARCH models. They have been defined with different mean assumptions and fitted with S&P 500 data.
The model with "constant mean" assumption has results saved in cmean_result
, and estimated volatility saved in cmean_vol
. The model with "AR(1)" or 1-lag autoregressive mean assumption has results saved in armean_result
, and estimated volatility saved in armean_vol
. The matplotlib.pyplot
and numpy
modules have been imported as plt
and np
respectively.
This exercise is part of the course
GARCH Models in Python
Exercise instructions
- Print out and review model fitting summaries of
cmean_result
andarmean_result
. - Plot the volatility estimation
cmean_vol
andarmean_vol
from both models. - Use
.corrcoef()
function fromnumpy
package to calculate the correlation coefficient.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Print model summary of GARCH with constant mean
print(____.____())
# Print model summary of GARCH with AR mean
print(____.____())
# Plot model volatility
plt.plot(____, color = 'blue', label = 'Constant Mean Volatility')
plt.plot(____, color = 'red', label = 'AR Mean Volatility')
plt.legend(loc = 'upper right')
plt.show()
# Check correlation of volatility estimations
print(np.____(____, ____)[0,1])