Python Statsmodel ARIMA 启动【平稳性】 [英] Python Statsmodel ARIMA start [stationarity]

查看:32
本文介绍了Python Statsmodel ARIMA 启动【平稳性】的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I just began working on time series analysis using statsmodels. I have a dataset with dates and values (for about 3 months). I am facing some issues with providing the right order to the ARIMA model. I am looking to adjust for trends and seasonality and then compute outliers.

我的价值观"不是固定的,statsmodel 说我必须要么诱导平稳,要么提供一些差异以使其发挥作用.我尝试了不同的排序(没有深入了解改变 p、q 和 d 的后果).

My 'values' are not stationary and statsmodel says that I have to either induce stationarity or provide some differencing to make it work. I played around with different ordering (without understanding deeply about the consequences of changing p,q and d).

当我为差分引入 1 时,出现此错误:

When I introduce 1 for differencing, I get this error:

ValueError: The start index -1 of the original series has been differenced away

当我通过将我的订单设为(例如)order = (2,0,1) 来删除差异时,我收到此错误:

When I remove the differencing by having my order as (say) order = (2,0,1), I get this error:

    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.
>>> 

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

Any help on how to induce stationarity (or a link to a nice tutorial) would be helpful. And, also, tests of stationarity (like, http://www.maths.bris.ac.uk/~guy/Research/LSTS/TOS.html) would be useful.

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

Update: I am reading through ADF test:

http://statsmodels.sourceforge.net/stable/generated/statsmodels.tsa.stattools.adfuller.html

谢谢!PD.

推荐答案

诱导平稳性:

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

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

There are several ways to achieve stationarity of a time series - Box-Cox family of transformations, Differencing etc., Choice of method depends on the data. Below are the commonly used tests for stationarity.

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

Tests for stationarity: 1. Augmented Dickey-Fuller test 2. KPSS test KPSS python code

这篇关于Python Statsmodel ARIMA 启动【平稳性】的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆