驗證 GARCH 模型假設

Python 中的 GARCH 模型

Chelsea Yang

Data Science Instructor

視覺檢查

原始報酬資料

標準化殘差

Python 中的 GARCH 模型

自我相關(Autocorrelation)

  • 描述變數在滯後 {{1}} 下與自身的相關性

  • 標準化殘差若存在自我相關,表示模型可能不穩健

檢測自我相關:

  • ACF 圖
  • Ljung-Box 檢定
Python 中的 GARCH 模型

ACF 圖

  • ACF:AutoCorrelation Function(自我相關函式)
  • ACF 圖:以滯後呈現自我相關的視覺化

ACF 圖

圖中的紅色區域表示信賴水準(alpha = 5%)

Python 中的 GARCH 模型

在 Python 中繪製 ACF 圖

from statsmodels.graphics.tsaplots import plot_acf

plot_acf(my_data, alpha = 0.05)
Python 中的 GARCH 模型

Ljung-Box 檢定

  • 檢定時間序列的一組自我相關是否有任一項顯著不為 0
  • H0:資料彼此獨立分配
  • P 值 < 5%:模型不穩健
Python 中的 GARCH 模型

Ljung-Box 檢定(Python)

# 匯入 Python 模組
from statsmodels.stats.diagnostic import acorr_ljungbox
# 執行 Ljung-Box 檢定
lb_test = acorr_ljungbox(std_resid , lags = 10)
# 檢查 p 值
print('P-values are: ', lb_test[1])
Python 中的 GARCH 模型

一起來練習吧!

Python 中的 GARCH 模型

Preparing Video For Download...