# ARIMA flattens out on one order and works perfect on another

I am implementing an ARIMA model on a time series data. I have confirmed that the data is stationary with the adfuller test. I plotted my ACF and PACF graph as below with a lag of 40.

Here, I see the PACF plot for AR order and the p value looks like 8. I see the ACF graph for the order of the MA model and the q value looks like 5. Since there is no differencing, the d value is 0. so with p=8, d=0 and q=5, I fit and predict the model but the prediction flattens out after a while.

I use the grid search method to find the minimal AIC score and find that the orders should be 3, 0, 5 for p, d and q respectively. I fit this model and predicted the results as below and it seems to be a really good fit. Orange line is for the previous model and the green line is for the newer order.

My question is, have I interpreted the PACF and ACF plots incorrectly? Because, number of lollipops out of the confidence boundary are as mentioned above but still the data does not fit correctly. If not, why does the prediction flatten out after fitting well for a small subset of the data?

• Your ACF and PACF plots confirm the data are not stationary: they are seasonal. (Evidently these are monthly data exhibiting an annual cycle). Use a seasonal model. The time series plots themselves exhibit a long-term trend. Use a first difference or explicitly model the trend.
– whuber
Commented Aug 9, 2023 at 19:13
• @whuber But doesnt the adfuller test resulting in a p-value of less than 0.05 signify that the data is stationary? Commented Aug 10, 2023 at 1:00

That a non-seasonal ARIMA model with $$d=0$$ flattens out is the way things should be mathematically. We have many questions on this "phenomenon", take a look at this search, or variants like this one. That your in-sample fit looks better is just overfitting (see above), and a nice illustration of the fact that in-sample fit is not a good guide to out-of-sample accuracy, or the capability of a model to detect any true underlying model.