Python Statsmodel ARIMA开始[平稳性]

use*_*931 10 python time-series statsmodels

我刚开始使用statsmodels进行时间序列分析.我有一个包含日期和值的数据集(大约3个月).我正面临着为ARIMA模型提供正确订单的一些问题.我希望调整趋势和季节性,然后计算异常值.

我的'价值'不是固定不变的,statsmodel说我要么必须诱导平稳性,要么提供一些差异以使其有效.我玩了不同的顺序(没有深入了解改变p,q和d的后果).

当我为差异引入1时,我收到此错误:

ValueError: The start index -1 of the original series has been differenced away
Run Code Online (Sandbox Code Playgroud)

当我通过命令(例如)order =(2,0,1)删除差异时,我收到此错误:

    raise ValueError("The computed initial AR coefficients are not "
ValueError: The computed initial AR coefficients are not stationary
You should induce stationarity, choose a different model order, or you can
pass your own start_params.
>>> 
Run Code Online (Sandbox Code Playgroud)

任何关于如何诱导平稳性(或指向一个很好的教程的链接)的帮助都会有所帮助.而且,平稳性的测试(例如,http://www.maths.bris.ac.uk/~guy/Research/LSTS/TOS.html)将是有用的.

更新:我正在通过ADF测试阅读:

http://statsmodels.sourceforge.net/stable/generated/statsmodels.tsa.stattools.adfuller.html
Run Code Online (Sandbox Code Playgroud)

谢谢!PD.

Rus*_*llB 2

诱导平稳性:

  1. 去季节性(消除季节性)
  2. 去趋势(消除趋势)

有多种方法可以实现时间序列的平稳性 - Box-Cox 系列变换、差分等,方法的选择取决于数据。以下是常用的平稳性检验。

平稳性测试: 1. 增强的 Dickey-Fuller 测试 2. KPSS 测试KPSS python 代码