协整模型

Python 中的时间序列分析

Rob Reider

Adjunct Professor, NYU-Courant Consultant, Quantopian

什么是协整?

  • 两个序列 $\large P_t$ 和 $\large Q_t$ 可各自为随机游走
  • 但线性组合 $\large P_t - c \ Q_t$ 可能不是随机游走!
  • 若如此
    • $\large P_t - c \ Q_t$ 可预测
    • 称 $\large P_t$ 与 $\large Q_t$ 协整
Python 中的时间序列分析

类比:拴着绳子的狗

  • $\large P_t = $ 牵犬人
  • $\large Q_t = $ 狗
  • 两个序列都像随机游走
  • 它们的差(或距离)呈均值回复
    • 狗落后太多,会被拽向前
    • 狗超前太多,会被拽回去
Python 中的时间序列分析

示例:取暖油与天然气

  • 取暖油和天然气都像随机游走……

Python 中的时间序列分析

示例:取暖油与天然气

  • 但价差(差值)均值回复

Python 中的时间序列分析

哪些序列会协整?

  • 经济替代品
    • 取暖油与天然气
    • 铂与钯
    • 玉米与小麦
    • 玉米与食糖
    • 比特币与以太坊?
  • 竞争对手呢?
    • 可口可乐与百事可乐?
    • 苹果与黑莓?不!绳子断了,狗跑了
Python 中的时间序列分析

检验协整的两步法

  • 用 $\large Q_t$ 回归 $\large P_t$,得到斜率 $\large c$
  • 对 $\large P_t - c \ Q_t$ 做增强型 Dickey–Fuller 检验,检验是否为随机游走
  • 或用 statsmodels 的 coint 函数,一步完成两者
from statsmodels.tsa.stattools import coint
coint(P,Q)
Python 中的时间序列分析

Passons à la pratique !

Python 中的时间序列分析

Preparing Video For Download...