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.
Cet exercice fait partie du cours
GARCH Models in Python
Instructions
- Print out and review model fitting summaries of
cmean_resultandarmean_result. - Plot the volatility estimation
cmean_volandarmean_volfrom both models. - Use
.corrcoef()function fromnumpypackage to calculate the correlation coefficient.
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de 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])