指定並品味各種 GARCH 模型風味
在接下來的章節中,你會看到 GARCH 模型有很多變體。因此你需要先指定要使用的平均模型、變異數模型,以及誤差分配。最佳模型是視情境而定的。實際的 GARCH 分析通常會指定、估計並檢定多個 GARCH 模型。
在 R 中,託 Alexios Ghalanos 所撰寫的 rugarch 套件之福,這件事很簡單。此套件已為你載入。你將把它用於分析 sp500ret 的每日報酬。
本練習屬於課程
R 的 GARCH 模型
練習說明
- 使用
ugarchspec()指定要估計具常數平均、且預測誤差為常態分配的標準 GARCH(1,1) 模型。 - 使用
ugarchfit()以極大概似法估計模型。 - 使用
sigma()方法擷取估計出的波動度。 - 繪製 2017 年的波動度預測。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Specify a standard GARCH model with constant mean
garchspec <- ___(mean.model = list(armaOrder = ___),
variance.model = list(model = "___"),
distribution.model = "___")
# Estimate the model
garchfit <- ___(data = ___, spec = ___)
# Use the method sigma to retrieve the estimated volatilities
garchvol <- ___
# Plot the volatility for 2017
___(___["2017"])