為何需要 GARCH 模型

Python 中的 GARCH 模型

Chelsea Yang

Data Science Instructor

課程總覽

GARCH:Generalized AutoRegressive Conditional Heteroskedasticity(廣義自我迴歸條件異質變異)

  • 第 1 章:GARCH 基礎
  • 第 2 章:GARCH 組態
  • 第 3 章:模型效能評估
  • 第 4 章:GARCH 實作
Python 中的 GARCH 模型

什麼是波動度

  • 描述金融資產報酬隨時間的離散程度
  • 常以報酬的標準差或變異數計算
  • 波動愈高,資產風險愈大

以波動衡量風險

Python 中的 GARCH 模型

如何計算波動度

  • 步驟 1:以價格變動百分比計算報酬 $$ return = {\frac{P_1 - P_0}{P_0}} $$

  • 步驟 2:計算樣本平均報酬 $$ mean = \frac {\sum_{i=1}^n {return_i} }n $$

  • 步驟 3:計算樣本標準差 $$ volatility = \sqrt\frac {\sum_{i=1}^n {(return_i - mean)}^2} {n-1}= \sqrt {variance}$$

Python 中的 GARCH 模型

在 Python 計算波動度

使用 pandas 的 pct_change() 方法:

return_data = price_data.pct_change()

使用 pandas 的 std() 方法:

volatility = return_data.std()
Python 中的 GARCH 模型

波動度換算

  • 由日波動換算成月波動:

(假設每月 21 個交易日)

$$\sigma_{monthly} = \sqrt{21} * \sigma_d$$

  • 由日波動換算成年波動:

(假設每年 252 個交易日)

$$\sigma_{annual} = \sqrt{252} * \sigma_d$$

Python 中的 GARCH 模型

波動建模的挑戰

異質變異(Heteroskedasticity):

  • 古希臘文:「不同」(hetero)+「離散」(skedasis)
  • 時間序列的波動會隨時間系統性改變

異質變異梗圖

Python 中的 GARCH 模型

檢測異質變異

同質變異 vs 異質變異

同質變異 vs 異質變異

Python 中的 GARCH 模型

波動叢聚

VIX 歷史價格:

VIX 歷史價格走勢圖

Python 中的 GARCH 模型

一起來練習吧!

Python 中的 GARCH 模型

Preparing Video For Download...