The function auto.arima in the forecast package of R is a powerful tool to identify the best ARIMA(p,d,q) model for a given data series. In the official documentation page of the function, they report the following:

auto.arima(y, d=NA, max.p=5, max.q=5, max.order=5, max.d=2, start.p=2, start.q=2, ...)

According to the above function it seems that, by default, auto.arima tries to find the best model among all the combination having:

  • p equal or lower than 5
  • q equal or lower than 5
  • d equal or lower than 2
  • order equal or lower to 5, i.e. p + q + d ≤ 5.

However, why does the default code stops at these conditions? Is there any particular reason why p, q and d should be equal or lower than 5, 5 and 2 and their sum lower than 5?


1 Answer 1


There are a number of reasons:

Restricting the search space limits the computation time required. This is an important factor if you are modeling and forecasting many time series.

More complex ARIMA models are hard to interpret. Intepretability may not be high on our list of desirable qualities if all we want to do is forecast, but often we need explain our models to a non-statistician user. I'd rather not try to explain even second differences, let alone third or higher ones.

Forecasters' experience has been that most time series are quite adequately described by ARIMA models of low orders. Let's model the 819 nonseasonal M3 series using auto.arima(,max.p=10,max.q=10,max.d=3):

M3.nonseasonal <- M3[sapply(M3,"[[","period")%in%c("YEARLY","OTHER")]
models <- matrix(NA,nrow=length(M3.nonseasonal),ncol=3,
pb <- winProgressBar(max=length(M3.nonseasonal))
for ( ii in seq_along(M3.nonseasonal) ) {
    fit <- auto.arima(M3.nonseasonal[[ii]]$x,max.p=10,max.q=10,max.d=3)
	models[ii,] <- fit$arma[c(1,6,2)]
  paste0( (",apply(models,1,paste0,collapse=","),")")),decreasing=TRUE)

The output:

> sort(table(paste0("(",apply(models,1,paste0,collapse=","),")")),decreasing=TRUE)

(0,1,0) (0,1,1) (0,2,0) (0,2,1) (1,0,0) (1,1,0) (0,0,0) (0,0,1) (2,0,0) (1,2,0) 
    413      80      65      60      31      29      23      19      15      13 
(1,1,1) (1,2,1) (2,1,0) (2,1,2) (0,3,0) (1,1,2) (2,2,1) (0,1,2) (0,2,2) (1,0,1) 
      6       6       6       6       5       5       5       4       3       3 
(1,3,0) (1,0,2) (1,2,2) (2,0,1) (2,1,1) (2,2,2) (3,0,0) (0,3,1) (1,3,1) (2,2,0) 
      3       2       2       2       2       2       2       1       1       1 
(2,3,1) (3,0,1) (3,1,0) (3,2,3) 
      1       1       1       1 
> summary(models)
       p                d             q         
 Min.   :0.0000   Min.   :0.0   Min.   :0.0000  
 1st Qu.:0.0000   1st Qu.:1.0   1st Qu.:0.0000  
 Median :0.0000   Median :1.0   Median :0.0000  
 Mean   :0.2393   Mean   :1.1   Mean   :0.2906  
 3rd Qu.:0.0000   3rd Qu.:1.0   3rd Qu.:1.0000  
 Max.   :3.0000   Max.   :3.0   Max.   :3.0000

In some few cases, auto.arima() opts for $d=3$, but I'm skeptical about integration of order 3, both because it is very hard to interpret and because it would lead to cubic trends, which rarely make sense. $p$ and $q$ never exceed 3.

Finally, more complex ARIMA models rarely are more accurate. As a matter of fact, the simplest possible ARIMA(0,0,0) model - i.e., white noise, with the optimal forecast being simply the historical mean - often outperforms more complex ARIMA models.

As far as I am aware, the specific defaults chosen don't stem from any specific research, and any such research would of course be of questionable generality. If you are really interested in how the package authors came up with these numbers, you could ask them (perhaps report here what you heard back?), but I strongly suspect that the answer will be "experience".

  • 2
    $\begingroup$ Wouldn't it be natural to allow for larger models for longer series? E.g. do something like max.p=sqrt(n) or max.p=log(n) where n is the sample size. If not, perhaps the reason is that ARMA models quickly plateau after p=q=5 so that adding another lag increases the model complexity without allowing for considerably richer patterns in the process. But is that true? Is that more true for ARMA than for other models like linear regression where we would consider adding another regressor instead of adding another lag? (The M3 series are probably quite short, so they aren't a great example.) $\endgroup$ Jun 13, 2017 at 10:52
  • 3
    $\begingroup$ @RichardHardy: yes, that would be an interesting question. I am not aware of any research in this direction, but it would be useful. However, I tentatively believe that longer time series probably do not justify higher ARMA lags or differences. Either the series are longer because they are sampled more often, in which case (multiple) seasonalities start becoming more important than longer lags. Or they become longer because we have collected data for a longer time, in which case I suspect that modeling changes in the DGP would be more urgent. $\endgroup$ Jun 13, 2017 at 10:59
  • 3
    $\begingroup$ Call me dogmatic, but I simply don't believe that adding a sixth AR term adds so much more understanding beyond the first five terms to justify the increase in variance. (And there doesn't seem to be a lot of justification for MA terms at all, beyond misspecification.) $\endgroup$ Jun 13, 2017 at 11:01
  • $\begingroup$ I agree with your first comment. Change of DGP is absolutely a concern. But I could say that a more complex ARMA model could be used to approximate the seasonality that appears there. After all, a SARMA is just a restricted ARMA. Regarding your second comment, I view MA terms as a tool for approximation. ARMA is more parsimonious than AR or MA alone, and since most of the models are never correct, only useful, including those parsimony-enhancing MA terms makes a lot of sense -- especially since ARMA models are often used for forecasting, not explanatory modelling. +1, anyway. $\endgroup$ Jun 13, 2017 at 11:03
  • 2
    $\begingroup$ Yes, SARMA is just restricted ARMA. However, for long seasonal periods (think weekly or daily data), you need a lot of observations before your ARMA notices that if should keep lags 1, 2 and 52 - and set all parameters in between to zero...¨ $\endgroup$ Jun 13, 2017 at 11:08

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.