3
$\begingroup$

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)[12] 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)[12] 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)[12] 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 ?

Thanks in advance,

Regards,

Ludo

$\endgroup$
  • $\begingroup$ 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 ... $\endgroup$ – Stat Jan 11 '13 at 6:02
  • $\begingroup$ 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. $\endgroup$ – Ludo Jan 11 '13 at 9:33
3
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ Thank you for your reply. Unfortunately, I am not authorized to publish this data on the internet. However, if I make no mistake, I think I am able to replicate the problem using the gas time series provided in the Forecast package. Please consider the code : data <- gas xreg_past <- 1:length(data) 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") 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") $\endgroup$ – Ludo Jan 14 '13 at 12:33
  • $\begingroup$ The first model returns an ARIMA(2,0,2)(0,1,2) model with an AIC of 8183.52. The AIC returned by trace (using an approximation) is 7996.88. The second model gives the same AIC in the trace using the same approximation. Perhaps you are comparing the AIC returned with that printed in the trace. The latter is an approximation. If you want the exact AIC, use the argument approximation=FALSE. $\endgroup$ – Rob Hyndman Jan 14 '13 at 12:58
  • $\begingroup$ I was clearly comparing the AIC in the final output with the one in the trace. Thank you for the explanation. $\endgroup$ – Ludo Jan 14 '13 at 13:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.