開始使用免費開始

變更估計樣本

拒絕 GARCH 模型有效性的原因可能有很多。可能是對平均數、變異數或分配的假設不正確;也可能是因為報酬的時間序列無法用同一組 GARCH 參數來描述。其實,考量金融市場的動態特性,合理的期待是 GARCH 模型參數會隨時間改變。因此,我們改用最近 2500 筆 EUR/USD 報酬來重新估計 GARCH 模型,而不是基於全部 4961 筆報酬進行分析。

本練習屬於課程

R 的 GARCH 模型

檢視課程

練習說明

  • tail() 函式在最後 2500 筆觀測值上估計 GARCH 模型。
  • 計算標準化報酬。
  • 進行 Ljung-Box 檢定,檢驗階數 1,…,22 的所有自我相關是否皆為 0。

動手互動練習

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

# Estimate the model on the last 2500 observations
tgarchspec <- ___( mean.model = list(armaOrder = c(0,0)),
                        variance.model = list(model = "sGARCH"),
                        distribution.model = "std")
tgarchfit <- ___( data = ___(EURUSDret, ___) , spec = tgarchspec)

# Compute standardized returns
stdEURUSDret <- ___(tgarchfit, standardize = TRUE)

# Do the Ljung-Box test on the absolute standardized returns
___(abs(stdEURUSDret), 22, type = "Ljung-Box")
編輯並執行程式碼