我想知道为什么即使在使用ARIMA(1,1,1)
时将微分阶数指定为1,也仍然会得到“计算出的初始AR系数不是固定的” 。 df['prod rate']
包含从1到20的升序值,我很确定要删除趋势,我需要在此处应用一阶差分。
我已经通过以下答案链接:
但是我找不到解决问题的办法。
from statsmodels.tsa.arima_model import ARIMA
plt.figure(figsize = (10,6))
model = ARIMA(df['prod rate'], order = (1,1,1))
results_AR = model.fit()
plt.plot(df['prod rate'], label = "Original")
plt.plot(results_AR.fittedvalues, color = 'red', label = 'Predictions')
plt.legend(loc = 'best')
在拟合模型时出现以下错误:
ValueError Traceback (most recent call last)
<ipython-input-59-2b92bbf4a4de> in <module>()
2 plt.figure(figsize = (10,6))
3 model = ARIMA(df['prod rate'], order = (1,1,1))
----> 4 results_AR = model.fit()
5 plt.plot(df['prod rate'], label = "Original")
6 plt.plot(results_AR.fittedvalues, color = 'red', label = 'Predictions')
3 frames
/usr/local/lib/python3.6/dist-packages/statsmodels/tsa/arima_model.py in _fit_start_params_hr(self, order, start_ar_lags)
539 if p and not np.all(np.abs(np.roots(np.r_[1, -start_params[k:k + p]]
540 )) < 1):
--> 541 raise ValueError("The computed initial AR coefficients are not "
542 "stationary\nYou should induce stationarity, "
543 "choose a different model order, or you can\n"
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.