开始使用免费开始使用

均值模型对波动率预测的影响

在实践中,收益率和波动率通常用各自独立的过程建模。一般来说,均值假设会影响预测的收益,但对波动率估计的影响较小。

在本练习中,您将通过比较两个 GARCH 模型,考察均值假设对波动率估计的影响。这两个模型使用不同的均值假设,并已用 S&P 500 数据拟合。

采用"常数均值"假设的模型,其结果保存在 cmean_result,对应的波动率估计保存在 cmean_vol。采用"AR(1)"(1 阶自回归)均值假设的模型,其结果保存在 armean_result,对应的波动率估计保存在 armean_volmatplotlib.pyplotnumpy 模块分别已按 pltnp 导入。

本练习是课程的一部分

Python 中的 GARCH 模型

查看课程

练习说明

  • 打印并查看 cmean_resultarmean_result 的模型拟合摘要。
  • 绘制两个模型的波动率估计 cmean_volarmean_vol
  • 使用 numpy 包中的 .corrcoef() 函数计算相关系数。

交互式实操练习

通过完成这段示例代码来试试这个练习。

# 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])
编辑并运行代码