样本内与滚动样本波动率对比
对于给定的收益率时间序列,您可以用 ugarchfit 的输出配合 sigma() 方法来估计 GARCH 波动率,或对 ugarchroll 的输出使用 as.data.frame() 方法。两者的区别在于:ugarchfit 只估计一次 GARCH 模型并使用完整的时间序列,从而得到样本内的波动率;而 ugarchroll 会在每个时点重新估计模型,只使用当时实际可观测的收益率。在本练习中,您需要比较使用偏度 student t 分布的 AR(1) GJR GARCH 模型对标普 500 日度收益的两种波动率预测。要用的 GARCH 设定已在 garchspec 中给出,数据位于 sp500ret。
本练习是课程的一部分
在 R 中构建 GARCH 模型
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Estimate the GARCH model using all the returns and compute the in-sample estimates of volatility
garchinsample <- ___(data = sp500ret, spec = garchspec)
garchvolinsample <- ___(___)