The following code was adapted from a related question, which I have never got it working.
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)
It throws exception when bruteforcing:
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.
I read a post on this problem here, yet didn't find it quite helpful.
Speaking of seasonality, someone suggests using X13as to handle it automatically. Any instruction on that?
Anyway, I desperately need a rock-solid example on ARIMA in Python. There shouldn't be so much pain, isn't it?