SARIMA
Seasonal ARIMA for time series with recurring seasonal patterns
Seasonal ARIMA (SARIMA) extends ARIMA by adding seasonal components to capture recurring patterns at fixed intervals. It's ideal for data with clear seasonal cycles like daily, weekly, monthly, or yearly patterns.
When to Use SARIMA
SARIMA is best suited for:
- Time series with clear seasonal patterns (daily, weekly, monthly, yearly)
- Data where patterns repeat at regular intervals
- Univariate forecasting with both trend and seasonality
- When you need statistical rigor with seasonal components
- Short to medium-term forecasts with seasonal behavior
- Business metrics with calendar effects (monthly sales, quarterly revenue)
Strengths
- Explicitly models seasonal patterns in addition to trend
- Well-established statistical framework with confidence intervals
- Interpretable seasonal and non-seasonal components
- Effective for capturing both short-term autocorrelation and seasonal cycles
- Provides prediction intervals for uncertainty
- Works well with relatively small datasets
- Can handle multiple types of seasonality with appropriate transformations
Weaknesses
- Requires manual specification of seasonal period
- Many parameters to tune: (p,d,q) × (P,D,Q,s)
- Limited to single seasonality (e.g., can't handle both weekly and yearly simultaneously)
- Cannot incorporate exogenous variables (use SARIMAX instead)
- Assumes linear relationships
- Computationally intensive for large seasonal periods
- Requires sufficient seasonal cycles (at least 2 complete seasons)
- Sensitive to outliers and structural breaks
Parameters
Common Time Series Parameters
All time series models share these parameters:
- Timestamp Column (required): Column containing dates/times
- Target Column (required): Numeric value to forecast
- Frequency (optional): Time spacing (D, H, W, M). Auto-inferred if not specified
- Forecast Steps (required, default=1): How many periods to predict
SARIMA-Specific Parameters
Non-Seasonal Components
AR Order (p)
- Type: Integer
- Default: 1
- Description: Number of autoregressive (lag) terms in the non-seasonal component
- Typical Range: 0-5
- Example: p=2 uses the previous 2 observations to predict the next
Differencing (d)
- Type: Integer
- Default: 1
- Description: Degree of non-seasonal differencing to make series stationary
- 0: No differencing (series is stationary)
- 1: First difference (removes linear trend)
- 2: Second difference (removes quadratic trend)
- Typical Range: 0-2
MA Order (q)
- Type: Integer
- Default: 1
- Description: Number of moving average (lagged forecast error) terms in non-seasonal component
- Typical Range: 0-5
Seasonal Components
Seasonal AR (P)
- Type: Integer
- Default: 1
- Description: Seasonal autoregressive order (lag at seasonal period)
- Typical Range: 0-2
- Example: P=1 with s=12 uses the value from 12 periods ago
Seasonal Diff (D)
- Type: Integer
- Default: 1
- Description: Degree of seasonal differencing
- 0: No seasonal differencing
- 1: Difference at seasonal lag (removes seasonal trend)
- Typical Range: 0-1
- Example: D=1, s=12 subtracts the value from 12 months ago
Seasonal MA (Q)
- Type: Integer
- Default: 1
- Description: Seasonal moving average order
- Typical Range: 0-2
Seasonal Period (s)
- Type: Integer
- Default: 12
- Description: Number of periods in one seasonal cycle
- Common Values:
- 7: Weekly seasonality in daily data
- 12: Monthly seasonality in monthly data
- 24: Daily seasonality in hourly data
- 4: Quarterly seasonality
- Important: Must match your data's seasonal pattern
Configuration Tips
Determining Seasonal Period (s)
Match the seasonal period to your data's repeating pattern:
- Daily data with weekly patterns: s=7
- Hourly data with daily patterns: s=24
- Monthly data with yearly patterns: s=12
- Quarterly data with yearly patterns: s=4
Starting Configuration
For most seasonal data, start with:
Non-seasonal: (p=1, d=1, q=1)
Seasonal: (P=1, D=1, Q=1, s=[your seasonal period])This is denoted as SARIMA(1,1,1)(1,1,1)s.
Choosing Between SARIMA and Simpler Models
- Use ARIMA if no seasonality: (p,d,q)(0,0,0)0
- Use SARIMA if clear seasonal patterns: (p,d,q)(P,D,Q)s
- Use Auto ARIMA to automatically find the best (p,d,q)(P,D,Q)s
Non-Seasonal vs Seasonal Parameters
- Non-seasonal (p,d,q): Captures short-term autocorrelation and trends
- Seasonal (P,D,Q): Captures patterns that repeat at lag s
You can have:
- Both non-seasonal and seasonal components (most common)
- Only seasonal: SARIMA(0,0,0)(P,D,Q)s
- Only non-seasonal: ARIMA(p,d,q) = SARIMA(p,d,q)(0,0,0)0
Interpretation Guide
SARIMA(1,1,1)(1,1,1)12 for monthly data:
- p=1: Current value depends on previous month
- d=1: Remove linear trend via differencing
- q=1: Model short-term noise
- P=1: Current value depends on same month last year
- D=1: Remove seasonal trend
- Q=1: Model seasonal noise
- s=12: Seasonal cycle is 12 months
Model Selection Strategy
- Identify s: Determine your seasonal period from domain knowledge
- Start simple: SARIMA(1,1,1)(1,1,1)s
- Check diagnostics: Look at ACF/PACF plots of residuals
- Tune if needed: Adjust orders based on residual patterns
- Compare models: Use AIC/BIC to select between candidates
Common Issues and Solutions
Issue: Model Training Takes Too Long
Solution:
- Large seasonal periods (s > 24) are computationally expensive
- Try reducing s (e.g., aggregate hourly to daily data)
- Consider Auto ARIMA instead for automatic order selection
- Use Prophet or TBATS for very large seasonal periods
Issue: Need Multiple Seasonalities (Weekly + Yearly)
Solution:
- SARIMA handles only one seasonal period
- Use TBATS for multiple seasonalities
- Use Prophet for automatic handling of multiple seasonal cycles
- Apply seasonal decomposition, model each component separately
Issue: Forecasts Fail to Capture Seasonal Pattern
Solution:
- Verify seasonal period s matches your data (s=7 for weekly in daily data, not s=52)
- Ensure at least 2 complete seasonal cycles in training data
- Increase seasonal parameters: try (P=2, D=1, Q=1)
- Check if D=1 is actually removing seasonality (may need D=0)
Issue: Model Won't Converge
Solution:
- Check for missing values or irregular timestamps
- Verify seasonal period s is correct
- Reduce parameter orders (start with all 1s)
- Ensure enough data: need at least 2×s observations minimum
- Remove extreme outliers
Issue: Poor Long-Term Forecasts
Solution:
- SARIMA designed for short to medium horizons (1-2 seasonal cycles ahead)
- For longer forecasts, consider Prophet or decomposition methods
- Reduce forecast_steps to reasonable horizon
- Consider models that explicitly extrapolate trends (Prophet, Exponential Smoothing)
Issue: Predictions Flatten After One Seasonal Cycle
Solution:
- This is expected for stationary SARIMA models
- Verify d and D are appropriate
- Consider growth models like Prophet for continuing trends
- Check if your data actually has a persistent trend vs mean reversion
Issue: Want External Variables (Promotions, Weather, etc.)
Solution:
- SARIMA doesn't support exogenous variables
- Use SARIMAX instead (adds eXogenous regressors)
- Or use Prophet with additional regressors
- Alternatively, model external variables separately and add to forecast
Example Use Cases
Monthly Retail Sales
- SARIMA(1,1,1)(1,1,1)12
- Captures month-to-month changes and yearly seasonal patterns
- s=12 for 12 months in a year
Daily Website Traffic
- SARIMA(1,1,1)(1,0,1)7
- s=7 for weekly patterns (higher traffic on weekdays vs weekends)
- D=0 if day-of-week effect is stable, D=1 if it trends
Hourly Energy Consumption
- SARIMA(2,0,1)(1,1,0)24
- s=24 for daily patterns (higher consumption during daytime)
- Aggregate to daily if hourly is too computationally expensive
Quarterly Earnings
- SARIMA(1,1,0)(1,1,0)4
- s=4 for yearly seasonality in quarterly data
- Simpler orders due to shorter series
Weekly Store Visitors
- SARIMA(1,0,1)(1,1,1)52
- s=52 for yearly patterns in weekly data
- Consider aggregating to monthly to reduce s to 12