開始使用免費開始

固定 GARCH 參數

GARCH 模型的參數是用極大概似法來估計的。由於抽樣的不確定性,估計出來的參數必然帶有估計誤差。如果我們知道參數的真實值,最好的做法就是直接施加該數值而不要再進行估計。

現在就以主控台中的每日 EUR/USD 報酬率變數 EURUSDret 為例。對這個資料,已經估計好採用偏態 student t 分配的 AR(1)-GARCH 模型,並以 flexgarchfit 這個 ugarchfit 物件提供給你。

本練習屬於課程

R 的 GARCH 模型

檢視課程

練習說明

  • 列印 flexgarchfit 的係數估計值。
  • 使用 setfixed() 方法指定參數限制為 ar1 = 0skew = 1
  • 在參數限制下重新估計模型。
  • 完成程式碼以繪製兩條波動度序列,並觀察它們的相似性。

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# Print the flexible GARCH parameters
___

# Restrict the flexible GARCH model by impose a fixed ar1 and skew parameter
rflexgarchspec <- flexgarchspec
___(rflexgarchspec) <- list(___ = ___, ___ = ___)

# Estimate the restricted GARCH model
rflexgarchfit <- ugarchfit(data = ___,  spec = ___)

# Compare the volatility of the unrestricted and restriced GARCH models
plotvol <- plot(abs(EURUSDret), col = "grey")
plotvol <- addSeries(___(flexgarchfit), col = "black", lwd = 4, on=1 )
plotvol <- addSeries(___(rflexgarchfit), col = "red", on=1)
plotvol
編輯並執行程式碼