開始使用免費開始

預測誤差

在 GARCH 模型下,變異數由預測誤差的平方所驅動,$e = R - \mu\(。因此,若要計算 GARCH 變異數,你需要先算出預測誤差。對於日報酬,常見作法是將 \)\mu$ 設為樣本平均

你將實作上述步驟,並驗證預測誤差絕對值存在顯著的正自我相關。正自我相關反映波動叢聚的存在。當波動高於平均時,通常會持續一段時間維持偏高;當波動較低時,也會持續一段時間偏低。

本練習屬於課程

R 的 GARCH 模型

檢視課程

練習說明

  • m 設為 sp500ret 中 S&P 500 日報酬的平均值。
  • 計算預測誤差。
  • 繪製預測誤差絕對值的時間序列。
  • 使用 acf 函式繪製預測誤差絕對值的自我相關函數。

動手互動練習

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

# Compute the mean daily return
m <- ___(___)

# Define the series of prediction errors
e <- ___ - ___

# Plot the absolute value of the prediction errors
par(mfrow = c(2,1),mar = c(3, 2, 2, 2))
___(___(___))

# Plot the acf of the absolute prediction errors
___
編輯並執行程式碼