# auto.arima from Forecast package

I am trying to fit a time series using the function auto.arima and I face some strange results.

As a first try, I use the command

auto.arima(data,d=0,D=1,max.p=2,max.q=2,max.P=2,max.Q=2,max.order=8, xreg=xreg_past,trace=TRUE,ic="aic")


The model I get is an ARIMA(2,0,2)(0,1,1) with an AIC equal to -300.14.

But since I know that this command will make use of the stepwise selection algorithm, I want to make a try with the tests of all possible models using the option stepwise=FALSE.

I thus try the command

auto.arima(data,d=0,D=1,max.p=2,max.q=2,max.P=2,max.Q=2,max.order=8, xreg=xreg_past,stepwise=FALSE,trace=TRUE,ic="aic")


And now, the model I get is an ARIMA(0,0,2)(2,1,0) with an AIC equal to -293.14. Since my second attempt takes all the models into account, this result is strange as the previous model had a lower AIC. Furthermore, If I take a look in the trace of the last function call, I see that the ARIMA(2,0,2)(0,1,1) model has now an AIC of -245.13 which explains why it has been rejected. Why did the AIC value change ?

At least, if I use the simple command

arima(data, order=c(2,0,2), seasonal= list(order=c(2,1,2), period=12), xreg=xreg_past)


I get an AIC value of -319.15, which is better that the two models provided before.

I think I am missing something important but I am not able to see what. Can somebody help me ?

Regards,

Ludo

• Try the following code instead of the first code that you wrote: auto.arima(data,d=0,D=1,max.p=2,max.q=2,max.P=2,max.Q=2, xreg=xreg_past,trace=TRUE,ic="aic") because the max.order should not be set when stepwise is TRUE. If that does not fix the problem then try to remove the arguments d=0,D=1,max.p=2,max.q=2,max.P=2,max.Q=2 in both models as well i.e. let the function select the orders ...
– Stat
Jan 11, 2013 at 6:02
• Hi ! Your first suggestion didn't change the result. For the second one, I don't think it will solve the problem. Indeed, the different conditions imposed on the orders are necessary for my work and I really need to understand why auto.arima doesn't choose the best model. Thanks for your help.
– Ludo
Jan 11, 2013 at 9:33

arima() will return different results from auto.arima() when differencing is used. Estimation with arima() uses a diffuse prior when the model is non-stationary, whereas auto.arima() fits the model to the differenced series.
I'm not sure why the two auto.arima() calls give different AIC values for the same model. Can you please post the data so the result can be replicated.