A Simple Guide to Auto-ARIMA/SARIMA and Auto-ARIMAX/SARIMAX

 
 

In this series, I will break down the available forecasting algorithms in IBP to make them easier to understand and implement in your demand planning processes. Among the most complex models that IBP offers is Auto-ARIMA/SARIMA. ARIMA stands for auto-regressive integrated moving average. The “S” in SARIMA stands for seasonal. So, the ARIMA model is either seasonal, in which case it’s a SARIMA model, or non-seasonal, in which case it’s an ARIMA model.


To put ARIMA simply, while exponential models describe the trend and seasonality of data, ARIMA models aim to describe the autocorrelations in the data. Autocorrelation represents the degree of similarity between a given time series and a lagged version of itself over successive time intervals. It’s a way of modeling time series data in such a way that:

  • a pattern based on past observations in the data is accounted for (hence the “auto-regressive” part) 

  • the trend and seasonal, otherwise known as non-stationary, pattern in the data is accounted for (hence the “integrated” part) 

  • noise between consecutive time points is accounted for (hence the “moving average” part) 

 

ARIMA models are typically expressed as “ARIMA(p,d,q)”, with the three terms p, d, and q defined as follows:

  • p means the number of preceding (“lagged”) Y values that are considered in a regression model of Y, to make better predictions based. This captures the “autoregressive” nature of ARIMA.

    • Stated simply: p is how many periods you want the model to consider for auto-regression. The most historical periods, the higher the p value. If the periodicity is month and you enter a 5, then the ARIMA model will consider only the past 5 months when forecasting demand for the future. 

  • d represents the number of times that the data have to be “differenced” to produce a stationary signal (i.e., a signal that has a constant mean over time). This captures the “integrated” nature of ARIMA, and is done prior to the AR or MA aspects of the model. If d=0, this means that our data does not tend to go up/down in the long term (i.e., the model is already “stationary”). In this case, then technically you are performing just ARMA, not AR-I-MA. If d is 1, then it means that the data is going up/down linearly. If d is 2, then it means that the data is going up/down exponentially.

    • Stated simply: ARIMA models use differencing (d) to transform the time series into a series without trend or seasonality (“stationary”). d is the number of differencing transformations required to get the dataset to be stationary. 0 would refer to a dataset that is already stationary. If you enter a 2 into IBP, then ARIMA will perform the differencing once, and then again, and then determine if the optimal number was 1 or 2.

  • q represents the number of preceding/lagged values for the error term (multiplied by a coefficient) that are added/subtracted to Y. This captures the “moving average” part of ARIMA.

    • Stated simply: q is the maximum number of periods in the sets of periods for which the moving average of forecast errors is calculated. So, if the periodicity is month and you enter 5 in this field, the system calculates the moving average of forecast errors for sets of not more than 5 periods. 


Auto-ARIMA combines auto-regression, differencing, and a moving average into a single model using the following steps (note, if seasonal, the first step becomes estimating the length of the seasonal cycle if not provided, and then assigning P, D, and Q parameters to the seasonal parts, as well as d, p, and q to non-seasonal parts):

  1. It checks whether differencing is required and identifies the optimal order for (d) if needed. 

  2. Using the optimal order for (d), it calculates the differences between consecutive observations to transform nonstationary data into stationary. 

  3. Using the selected information criterion and the optimal order for (d), it calculates various combinations of (p), (q), and (d) until it can identify the optimal order for (p) and (q). 

  4. For example, a possible combination of orders is (2,1,3) for (p,d,q). 

  5. Using the optimal orders for (p) and (q), it calculates the forecast by applying autoregression and moving average on the differenced data. 

The “Auto-” part of the name Auto-ARIMA in IBP means you do not have to provide the p, d, and q parameters, in which case the model will combine autoregression and moving average to provide reliable forecasts after calculating the optimal values for certain parameters automatically and differencing the historical data to make it stationary if needed.

Stepwise vs Exhaustive: When you create an Auto-ARIMA model, you will be able to choose between Stepwise and Exhaustive. With a Stepwise process, IBP will test orders one by one for each parameter (p, d, and q) and select those that make the most significant improvements. To better understand, note that setting p, d, and q to (3,3,3) doesn’t mean you're telling Auto-ARIMA to "use 3 weeks for auto-regression, difference the dataset twice, and use 3 weeks for moving average." Instead, you're telling ARIMA "test up to 3,3,3." It will test 1, 2, and 3 for p. It will test 0, 1, 2, and 3 for d. It will test 1, 2, and 3 for q. And then Auto-ARIMA will pick whichever one gives the most improvement in the error.

Exhaustive tests all possible combinations of p,d,q. For example, if you set maximum 2 for the (p) order and maximum 2 for (q), the system considers the following (p,q) combinations: (0,0), (0,1), (0,2), (1,0), (1,1), (1,2), (2,0), (2,1), (2,2) and selects the one that yields the lowest error (known as information criterion). In case of an auto-SARIMA model, all possible (p,q,P,Q) quadruplets are used when the determining the optimal model. Exhaustive search takes longer and is more system-intensive than the stepwise search, but it can yield more accurate results.

You may notice in IBP that there is an Auto-ARIMA/SARIMA and another model named Auto-ARIMAX/SARIMAX. The automated autoregressive integrated moving average with explanatory variables algorithm (auto-ARIMAX) is similar to auto-ARIMA in that it combines autoregression and moving average to provide reliable forecasts after calculating the optimal values for certain parameters automatically and differencing the historical data to make it stationary if needed. However, auto-ARIMAX also considers independent variables (for example, temperature or GDP) that can explain various changes in the time series and help in creating more exact forecasts.

Within IBP, you’ll also notice you have the choice of which Information Criterion you’d like to use. Which is better? The real answer is they’re both VERY likely to have the same results. BIC is better when the “true model” is present (the right combination of (p,d,q), but you don’t really know if the “true model” is present and my personal opinion is it could just be a case of overfitting. I’d use AIC as it’s a bit more forgiving, in my opinion.

Auto-ARIMA/SARIMA models have various pros and cons. One pro within IBP is the model is easy to use and doesn’t require expert knowledge. However, it is system-intensive and thus slow to execute due to the number of calculations required. It also requires a large dataset to provide good results.


Now that we understand Auto-ARIMA in its entirely, here’s how I’d summarize:

ARIMA stands for auto-regressive integrated moving average, which means it models by making the data set stationary through differencing using d (“integrated” part), pattern of past observations using p (“auto-regressive” part), and noise between consecutive time points using q (“moving average” part).

The “Auto-” part of Auto-ARIMA means it can choose p, q, and d for you. If you want a starting point, I tend to use (3,3,3). In most cases, going above 3 would increase the time it takes to run the forecast with little actual benefit.

SARIMA is like ARIMA but for seasonal datasets. 

ARIMAX/SARIMAX is like ARIMA/SARIMA but with independent variables. 

Stepwise and exhaustive are both fine. Exhaustive may provide a more accurate result but will take longer, be more system intensive, and may overfit the data.

Either information criterion is fine, but I find AIC to be a bit more forgiving than BIC. 

As with other models more data tends to be better, so if you have less than two years of historical data Auto-ARIMA/SARIMA may not be right for you.

Previous
Previous

Level 4 Planning with SAP IBP

Next
Next

Supply or Demand: Who’s to Blame?