# auto.arima cannot offer best model lowest aic

I am analyzing this data.

Here is my code

library(fpp)
library(urca)

setwd("C:/Users/kuco/Desktop") #where is the file folder

t<-ts(dt,start = c(1997,1),frequency = 12) #put it into time series data

fit1<-auto.arima(t,stepwise = F,approximation = FALSE,ic="aic",D=1) #find the best model
fit1 #show the best model

fit2<-arima(t,order=c(1,1,2),seasonal = list(order=c(1,1,1)))
fit2


But it turns out that the arima(1,1,2)(1,1,12)[12] is better than the model from auto.arima(). So what can I do to get the lowest AIC model?

• You cannot directly compare the AIC for models with different integration orders. Thus your AIC comparison does not tell which model is actually better. Feb 22 '17 at 15:10
• i select minimize the aic when using the auto.airma, it should give the model with the lowest aic. :> Feb 22 '17 at 17:29
• If you check the algorithm behind auto.arima, you will see that AIC is used within a fixed order of integration, but not across them. The order of integration (seasonal and simple) is determined by tests (OCSB and KPSS, respectively). Feb 22 '17 at 17:45
• Your SMA coefficient (-.7706 or -.8901) suggests possible unwarranted seasonal differences as it is in the neighborhood of -1.0. Feb 23 '17 at 23:27

For that reason, the order of differencing is not chosen by AIC in auto.arima. Instead, unit root tests are used.
Even after the differencing is selected, the model returned will not necessarily have the minimum AIC because various other checks are done to ensure the model is well-behaved and numerically stable. For example, the model you fit is returning NaN values for some standard errors -- a sign of numerical instability in the likelihood. Such a model would never be returned by auto.arima. It also avoids models that have roots close to the unit circle.