预测波动率与 VaR 的共同波动
VaR 图显示下行风险存在显著的时间变化。这种时间变化主要由收益波动率的时间变化所驱动。在本练习中,您将通过在同一图中绘制 5% VaR 与估计的波动率,来验证微软日度收益是否符合这一特征。保存滚动 GARCH 估计输出的对象 garchroll 已在控制台中为您准备好。
本练习是课程的一部分
在 R 中构建 GARCH 模型
练习说明
- 从
garchroll中获取包含均值与波动率预测的数据框。 - 使用合适的方法从
garchroll提取 5% VaR。 - 从 garchpreds 中提取波动率。
- 在时间序列图中分析二者的共同波动。
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Extract the dataframe with predictions from the rolling GARCH estimation
garchpreds <- ___(garchroll)
# Extract the 5% VaR
garchVaR <- ___(garchroll, ___ = ___)
# Extract the volatility from garchpreds
garchvol <- xts(garchpreds$___, order.by = time(garchVaR))
# Analyze the comovement in a time series plot
garchplot <- plot(garchvol, ylim = c(-0.1, 0.1))
garchplot <- addSeries(garchVaR, on = 1, col = "blue")
plot(garchplot, main = "Daily vol and 5% VaR")