描述模型

Python 中的時間序列分析

Rob Reider

Adjunct Professor, NYU-Courant Consultant, Quantopian

MA(1) 模型的數學描述

$\large \quad \quad \quad \quad R_t \ = \ \ \mu \ \ + \ \ \epsilon_t \ + \ \ \theta \ \epsilon_{t-1} $

  • 右側只有一個落後誤差,稱為:
    • 1 階 MA 模型,或
    • MA(1) 模型
  • MA 參數為 $\large \theta$
  • 對所有 $\theta$ 值皆為定態
Python 中的時間序列分析

MA(1) 參數的詮釋

$\large \quad \quad \quad \quad R_t \ \ = \ \ \mu \ \ + \ \ \epsilon_t\ + \ \ \theta \ \epsilon_{t-1} $

  • $\large \theta$ 為負:單期均值回復
  • $\large \theta$ 為正:單期動能
  • 注意:一期自我相關為 $\large \theta/(1+\theta^2)$,不是 $\large \theta$
Python 中的時間序列分析

MA(1) 自我相關函式比較

  • $\large \theta=0.9$

  • $\large \theta=0.5$

  • $\large \theta=-0.9$

  • $\large \theta=-0.5$

Python 中的時間序列分析

MA(1) 過程範例:盤中股票報酬

Python 中的時間序列分析

盤中股票報酬的自我相關函式

Python 中的時間序列分析

高階 MA 模型

  • MA(1)

$\large \quad \quad R_t = \mu + \epsilon_t - \theta_1 \ \epsilon_{t-1}$

  • MA(2)

$\large \quad \quad R_t = \mu + \epsilon_t - \theta_1 \ \epsilon_{t-1} - \theta_2 \ \epsilon_{t-2}$

  • MA(3)

$\large \quad \quad R_t = \mu + \epsilon_t - \theta_1 \ \epsilon_{t-1} - \theta_2 \ \epsilon_{t-2} - \theta_3 \ \epsilon_{t-3}$

  • ...
Python 中的時間序列分析

模擬 MA 過程

from statsmodels.tsa.arima_process import ArmaProcess
ar = np.array([1])
ma = np.array([1, 0.5])
AR_object = ArmaProcess(ar, ma)
simulated_data = AR_object.generate_sample(nsample=1000)
plt.plot(simulated_data)
Python 中的時間序列分析

一起來練習吧!

Python 中的時間序列分析

Preparing Video For Download...