Learn how to use SARIMAX to make forecasts.

Understanding SARIMAX

To review, SARIMAX combines multiple time series components—seasonality, autoregression, integration, moving average, and exogenous variables. It takes essentially two parameters—order, which refers to autoregression, integration, and moving average and seasonal_order, which refers to seasonality. To use SARIMAX for seasonality purposes only, all we need to do is set order = (0,0,0) and work only with seasonal_order.

Let's understand how seasonal_order(P, D, Q, M) works by calling the function parameters P,D,QP, D,Q, and MM in that order.

  • PP is the seasonal component's autoregressive order.

  • DD is the seasonal component's integration order.

  • QQ is the seasonal component's moving average order.

  • MM is the periodicity. Since we have monthly data, we set it to 12.

SARIMAX works just like SARIMA except that it allows us to add exogenous variables (hence the X). When predicting the number of airline passengers, for instance, it might be useful to add the number of searches for the term "airline tickets" in the past six months. The exogenous variable is a new variable in addition to the time series we're looking at.

Forecasting with SARIMAX

To forecast with SARIMAX, we can start specifying our exogenous variable and adding it to the SARIMAX model together with its order parameter.

Get hands-on with 1200+ tech skills courses.