Solved – auto.arima Not Minimizing AIC

arimamoving averagertime series

I simulated a MA(3) process using:

set.seed(66)
w <- rnorm(100,0,3.6)
p1 <- 0.4; p2 <- -0.2; p3 <- 0.3;
ma3 <- w[1]
ma3[2] <- w[2] + p1*w[1] 
ma3[3] <- w[3] + p1*w[2] + p2*w[1]
for (t in 4:100) ma3[t] <- w[t] + p1*w[t-1] + p2*w[t-2] + p3*w[t-3]

Running auto.arima on the time series gives:

> auto.arima(ma3)                                   
Series: ma3 
ARIMA(0,0,1) with zero mean     

Coefficients:
         ma1
      0.3854
s.e.  0.1152

sigma^2 estimated as 14.41:  log likelihood=-275.39
AIC=554.77   AICc=554.89   BIC=559.98

However, fitting the series to a MA(3) model gives a lower AIC:

> arima(ma3, order=c(0,0,3))

Call:
arima(x = ma3, order = c(0, 0, 3))

Coefficients:
         ma1      ma2     ma3  intercept
      0.4039  -0.0836  0.5125     0.2752
s.e.  0.1158   0.0905  0.1039     0.6078

sigma^2 estimated as 11.2:  log likelihood = -264.67,  aic = 539.34

I'm not sure what's going on. I thought that auto.arima selected the best model based on the AIC.

Best Answer

By default, auto.arima uses a stepwise search and there is no guarantee that it will find the best model. You can do a more complete search by setting stepwise=FALSE in the call. Like this:

> library(forecast)
> auto.arima(ma3,stepwise=FALSE)

Series: ma3 
ARIMA(3,0,0) with zero mean     

Coefficients:
         ar1      ar2     ar3
      0.3203  -0.0556  0.2816
s.e.  0.0976   0.1025  0.0984

sigma^2 estimated as 13.74:  log likelihood=-271.57
AIC=551.15   AICc=551.57   BIC=561.57

However, this still hasn't found an MA(3) model. That is because the fitted MA(3) model is almost non-invertible.

> fit <- Arima(ma3, order=c(0,0,3))
> plot(fit)

enter image description here

Note the root lies almost on the unit circle. auto.arima will not consider models that are close to the stationarity or invertibility boundary, as they are typically numerically unstable.

Related Question