Based on the partial autocorrelation function (PACF) and ACF plots, we usually define a model that matches the data reasonably well. We can choose the best model by comparing their Aikake information criterion (AIC) values, and picking the model with the smallest value.
However, this is not very practical when we need to work with many time series. The forecast package offers a function that is quite often used in the industry, which is the auto.arima() function. With this function, we can specify the maximum number of p,q orders that we want to try, along with the maximum P,Q orders for the seasonal part. It has a very important parameter called stepwise, which governs how the search is done. If we want it done by searching among all possible models, we want stepwise=FALSE. It is certainly the best option when the model can...