# auto.arima doesn't calculate AIC values for the majority of models

I have manually discovered that the best model for my time series is the next one (AIC = 244.9): But auto.arima function tells me that the best model is (0,1,0) with AIC = 247.93: If I look at the trace I see: Why can't auto.arima calculate AIC values for the majority of the models and returns Inf?

This is probably explained in the documentation. Looking the source code I found that Inf is reported when the likelihood of the model turns out to be infinity or when the lowest root in the polynomials of the model are lower than 1.01.

When the AR polynomial is close to be non-stationary or when the MA polynomial is close to be non-invertible, then the model is rejected by setting an infinite value for the AIC related to that model.

Inf * is reported when the ARIMA model couldn't be fitted and an error was returned by stats::arima.

For example, the following reports a value of the AIC equal to Inf for the model ARIMA(2,1,2):

x <- diff(log(AirPassengers), 12)
auto.arima(x, ic="aic", seasonal=FALSE, allowdrift=FALSE, trace=TRUE)
# ARIMA(2,1,2)                    : Inf
# ARIMA(0,1,0)                    : -428.4098
# ... ... ...
# ARIMA(3,1,3)                    : -447.2594
# ARIMA(3,1,2)                    : -446.4202
# Best model: ARIMA(3,1,3)


Fitting this particular model, we can see that the MA polynomial is close to be non-invertible, that's why auto.arima sets a large value to the AIC in order to make sure that this model is not chosen:

fit <- arima(x, order=c(2,1,2))
fit
# Coefficients:
#          ar1     ar2      ma1      ma2
#       0.2336  0.4912  -0.6445  -0.3554
# s.e.  0.2514  0.1824   0.2776   0.2761
AIC(fit)
#  -450.962


However, we can see that the MA polynomial is close to be non-invertible, that's why auto.arima sets a large value to the AIC in order to make sure that this model is not chosen:

# Roots of the AR polynomial (stationary)
abs(polyroot(c(1,-coef(fit)[c("ar1", "ar2")])))
#  1.208756 1.684228
# Roots of the MA polynomial (the first is close to unity, < 1.01)
abs(polyroot(c(1,coef(fit)[c("ma1", "ma2")])))
#  1.000013 2.813392