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?