平稳性

Python 中的时间序列分析

Rob Reider

Adjunct Professor, NYU-Courant Consultant, Quantopian

什么是平稳性?

  • 强平稳:数据的整体分布对时间不变
  • 弱平稳:均值、方差与自相关对时间不变(即自相关 corr$\large (X_t, X_{t-\tau})$ 仅为 $\large \tau$ 的函数)
Python 中的时间序列分析

为何重要?

  • 若参数随时间变化,需估计的参数过多
  • 只能估计少量参数的简约模型
Python 中的时间序列分析

非平稳序列示例

  • 随机游走
Python 中的时间序列分析

非平稳序列示例

  • 序列中的季节性
Python 中的时间序列分析

非平稳序列示例

  • 均值或标准差随时间变化
Python 中的时间序列分析

将非平稳序列转为平稳序列

  • 随机游走
    plot.plot(SPY)
    
  • 一阶差分
    plot.plot(SPY.diff())
    
Python 中的时间序列分析

将非平稳序列转为平稳序列

  • 季节性
    plot.plot(HRB)
    
  • 季节差分
    plot.plot(HRB.diff(4))
    
Python 中的时间序列分析

将非平稳序列转为平稳序列

  • 亚马逊季度营收
    plt.plot(AMZN)
    
# Log of AMZN Revenues
plt.plot(np.log(AMZN))

# Log, then seasonal difference
plt.plot(np.log(AMZN).diff(4))

Python 中的时间序列分析

让我们来练习!

Python 中的时间序列分析

Preparing Video For Download...