📊

SARIMA and SARIMAX Models

Jul 12, 2024

SARIMA and SARIMAX Models

Introduction to Seasonal ARIMA

  • Seasonal ARIMA (SARIMA) is an extension of the ARIMA model that introduces a seasonal component.
  • ARIMA Basics:
    • p: Order of the autoregressive part.
    • q: Order of the moving average part.
    • d: Differencing needed to make the time series stationary.

Key Concepts in SARIMA

  • Seasonal Components:
    • Introduces additional terms for autoregression, moving average, and differencing that correspond to the seasonal factor.
    • Define seasonality in terms of a specific period (e.g., 1 year, 12 months).
      • Example: 1 year seasonality = 12 months (lags of 12).
      • For two seasonal lags: 24 months or 2 years.

Implementation in Python

  • Libraries: statsmodels.tsa
    • SARIMA can be implemented using statsmodels in Python.
    • Function: SARIMAX for time series data.
      • Order Parameter: Defines non-seasonal components (p, d, q).
      • Seasonal Order: Defined by capital letters (P, D, Q, m) where m represents the number of periods in each season.
      • Exogenous Component: Parallel time series data not directly related to the original time series; accounts for external effects.
        • Example: exog = some_external_data.

SARIMA vs SARIMAX

  • SARIMA: Seasonal ARIMA without exogenous variables.
  • SARIMAX: Seasonal ARIMA including exogenous variables.
    • If no exogenous data is provided, SARIMAX defaults to SARIMA.

Summary

  • Use SARIMA for modeling seasonal patterns in time series data.
  • Use SARIMAX when there are external factors affecting the time series.
  • Both models can be used within the statsmodels.tsa framework in Python.