以下代码改编自a related question,我从未使用它。
def objfunc(order, endog, exog=None):
from statsmodels.tsa.arima_model import ARIMA
fit = ARIMA(endog, order, exog, freq='D').fit()
return fit.aic
from scipy.optimize import brute
grid = (slice(1, 3, 1), slice(1, 3, 1), slice(1, 3, 1))
brute(objfunc, grid, args=([1.350320637, 1.39735651, 1.712129712, 1.718507051, 1.772633255, 1.766728163, 1.590842962, 1.386521041, 1.71810019, 1.743380606, 1.718501449, 1.77709043, 1.823061287, 1.562814653],), finish=None)
在强制执行时抛出异常:
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.
我读了一篇关于此问题的帖子here,但没有发现它非常有帮助。
说到季节性,有人建议使用X13as自动处理它。关于那个的任何指示?
无论如何,我迫切需要一个关于Python中ARIMA的坚如磐石的例子。不应该有这么大的痛苦,不是吗?