Why I got 'The computed initial AR coefficients are not stationary' while using aic_min_order?

柔情痞子 提交于 2019-12-24 10:54:08

问题


I generate some data like [1, 6, 1, 6, 1, 6] and add noises under normal distribution. I use arma_order_select_ic to select order. Then aic_min_order is used to fit the ARMA model. Sometime the model works well. But sometimes it raises ValueError.

ValueError: The computed initial AR coefficients are not stationary

Here is my code.

import statsmodels.api as sm
import numpy as np
x = [1 if i%2 == 0 else 6 for i in range(50)]
eta = np.random.normal(0, 0.01, 50)
x = x + eta
res = sm.tsa.stattools.arma_order_select_ic(x, ic=['aic']) 
print res.aic_min_order
model = sm.tsa.ARMA(x, res.aic_min_order).fit(disp = 0)
print model.predict(45, 55)

Do I miss something or ARMA don't fit this kind of data?


回答1:


ARMA is designed for stationary processes and by default imposes stationarity on the parameter estimates.

Your data is not stationary, i.e. it the lag polynomial has a seasonal unit root. The usual treatment is to use seasonal differencing or a deterministic seasonal pattern for example with dummy variables or splines.

Statsmodels has currently no automatic season detection and model selection, but SARIMAX can be used for seasonal integrated ARMA processes.



来源:https://stackoverflow.com/questions/42453381/why-i-got-the-computed-initial-ar-coefficients-are-not-stationary-while-using

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!