问题描述
我刚开始使用 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
当我通过将我的订单设置为(比如)订单 = (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
谢谢!警察局.
推荐答案
诱导平稳性:
- 去季节性(去除季节性)
- 去趋势(去除趋势)
有几种方法可以实现时间序列的平稳性 - 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 启动 [平稳性]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!