預測波動度與 VaR 的同步變動
Value-at-Risk 圖顯示下行風險有明顯的時間變動。這種時間變動主要由報酬率波動度的時間變動所驅動。這題你將以微軟(Microsoft)日報酬為例,將 5% Value-at-Risk 與估計的波動度畫在同一張圖上,來驗證這件事。變數 garchroll(包含滾動 GARCH 估計的輸出)已經在主控台可用。
本練習屬於課程
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")