Box-Jenkins 方法

Python 中的 ARIMA 模型

James Fulton

Climate informatics researcher

Box-Jenkins 方法

從原始資料 $\rightarrow$ 產線模型

  • 辨識
  • 估計
  • 模型診斷
Python 中的 ARIMA 模型

辨識(Identification)

  • 時間序列是定態的嗎?
  • 需要哪些差分能讓它定態?
  • 需要哪些轉換能讓它定態?
  • 哪些 p 與 q 值最有希望?

Python 中的 ARIMA 模型

辨識工具

  • 繪製時間序列
    • df.plot()
  • 使用擴增 Dickey-Fuller 檢定
    • adfuller()
  • 使用轉換與/或差分
    • df.diff(), np.log(), np.sqrt()
  • 繪製 ACF/PACF
    • plot_acf(), plot_pacf()

Python 中的 ARIMA 模型

估計(Estimation)

  • 使用資料訓練模型係數
  • 透過 model.fit() 自動完成
  • 用 AIC 與 BIC 在模型間擇優
    • results.aic, results.bic

Python 中的 ARIMA 模型

模型診斷

  • 殘差是否不相關?
  • 殘差是否近似常態分布?
    • results.plot_diagnostics()
    • results.summary()

Python 中的 ARIMA 模型

決策

Python 中的 ARIMA 模型

重複(Repeat)

  • 帶著更多資訊再跑一次流程
  • 尋找更佳模型

Python 中的 ARIMA 模型

上線(Production)

  • 準備進行預測
    • results.get_forecast()

Python 中的 ARIMA 模型

Box-Jenkins

Python 中的 ARIMA 模型

一起來練習吧!

Python 中的 ARIMA 模型

Preparing Video For Download...