I have endog variable (with 200 observations), exog variable (with 200 observations)
I want to train ARIMAX model on 163 observations and predict 181th observation,
then train on 164 observations and predict 182nd observation, and so on until train on 182 observations and then predict 200th observation. (I want to collect list of Y hats(from 182 to 200)) (I have list of Y values(from 182 to 200)) now I want to compute Rsquare.
I want to use the same combination of AR terms and MA terms (p=AR=3, q=MA=3 and d=2) each time that is from 163 to 182
I'm using the below function to fit the ARIMAX model in Python:
arimax_mod2 = sm.tsa.ARIMA(endog, (p,d,q), exog).fit()
The problem here is when I'm using a combination say (AR(3), MA(3)) this works for training on 163 observations and predicting 181st and training on 164 observations and predicting on 182nd but the same combination doesn't work on (for example) training on 170 observations and predicting 188th observation.
I'm encountered with a ValueError: The computed initial MA coefficients are not invertible
If the fit method works fine I can get the Y-hat values using
arimax_mod2.forecast
Can anyone guide me oh how to resolve this error.