🎓 Lesson 21 D5

Residual Seasonality Detection Using STL Decomposition

Residual seasonality detection using STL decomposition is a way to spot leftover repeating patterns in forecasting errors after removing trends and known seasonal cycles.

🎯 Learning Objectives

  • Apply STL decomposition to isolate residual components from renewable power forecast errors
  • Analyze residuals using autocorrelation (ACF) and spectral density to detect statistically significant seasonality
  • Explain how undetected residual seasonality violates white-noise assumptions in forecast error diagnostics
  • Design corrective actions—such as adding harmonic regressors or adjusting seasonal period parameters—based on residual seasonality findings

📖 Why This Matters

In AI-augmented renewable forecasting infrastructure, a 'clean' residual error is foundational: it signals that the model has captured all systematic behavior—including daily, weekly, and annual cycles. But real-world data often hides subtle, non-integer, or multi-scale seasonalities—like wind farm output shifting 15 minutes earlier each day due to solar-heating-induced boundary layer changes, or photovoltaic curtailment patterns tied to utility tariff windows. If residual seasonality goes undetected, forecast uncertainty quantification fails, probabilistic intervals widen incorrectly, and automated dispatch systems make suboptimal decisions. Detecting it isn’t academic—it’s a regulatory and operational necessity under ISO reliability standards.

📘 Core Principles

STL decomposition operates in two nested loops: an inner loop estimates seasonal and trend components using locally weighted regression (Loess), while an outer loop refines robustness by down-weighting outliers in the residual. The key insight is that STL allows flexible seasonal periods (e.g., 24.3 h for solar irradiance drift, not just fixed 24 h) and handles non-stationary seasonality. Residual seasonality arises when the chosen seasonal window (s.window) or degree of trend smoothness (t.degree) is insufficient—leaving periodic signal in the remainder. Detection requires moving beyond visual inspection: formal tests include the Canova-Hansen test for seasonal unit roots, spectral peak significance (via Fisher’s g-test), or ACF-based Ljung-Box Q-statistics at seasonal lags. Critically, in mining/blasting-adjacent contexts—such as forecasting energy demand for remote mine sites powered by hybrid solar-diesel-battery systems—residual seasonality may reflect shift-change schedules, conveyor belt maintenance windows, or blast timing rhythms synchronized to grid off-peak hours.

📐 Spectral Peak Significance Test (Fisher's g-test)

Fisher’s g-test evaluates whether the largest normalized spectral peak in the residual’s periodogram exceeds noise expectations—indicating statistically significant periodicity. It’s preferred over ACF for detecting weak, narrow-band seasonality buried in noise.

Fisher's g-statistic

g = I_max / Σ_{j=1}^{N/2} I_j

Measures the relative magnitude of the largest periodogram peak to assess significance of dominant frequency in residuals.

Variables:
SymbolNameUnitDescription
I_max Maximum periodogram ordinate dimensionless Normalized power spectral density at the dominant frequency
I_j Periodogram ordinate at frequency j dimensionless Spectral power estimate across all Nyquist frequencies
Typical Ranges:
Clean residuals (no seasonality): 0.001 – 0.005
Moderate residual seasonality: 0.01 – 0.15
Strong residual seasonality: > 0.20

💡 Worked Example

Problem: Given residuals from a 15-min resolution solar forecast (N = 960 points, covering 7 days), the periodogram yields a maximum normalized power of 0.32 at frequency f = 0.0417 cycles/min (corresponding to ~24-hour period). Compute Fisher’s g and assess significance at α = 0.05.
1. Step 1: Compute g = I_max / ΣI_j, where I_max = 0.32 and ΣI_j = sum of all normalized periodogram ordinates = 1.0 (by definition of normalization). So g = 0.32.
2. Step 2: For N = 960, the critical value g_crit for α = 0.05 is approximated via g_crit ≈ −log(1 − α^(1/(N/2−1))) ≈ −log(1 − 0.05^(1/479)) ≈ 0.0061 (using asymptotic approximation).
3. Step 3: Since g = 0.32 ≫ 0.0061, reject null hypothesis: significant residual seasonality exists at ~24-h period.
Answer: The result is g = 0.32, which far exceeds the critical value of ~0.0061—confirming statistically significant 24-hour residual seasonality requiring model revision.

🏗️ Real-World Application

At the DeGrussa Copper Mine (Western Australia), a hybrid solar-diesel-battery microgrid experienced persistent 7-day forecast errors in load demand. STL decomposition of 15-min forecast residuals revealed a strong spectral peak at 168 h (weekly), corresponding to rostered shift rotations and scheduled maintenance shutdowns—patterns not encoded in the original LSTM model’s calendar features. After augmenting inputs with binary weekly-cycle indicators and adjusting STL’s s.window from 168 to 170 (to accommodate slight schedule drift), residual seasonality vanished (g dropped from 0.28 to 0.004), and MAE reduced by 12.3% during peak operational weeks. This case is documented in AEMO’s 2023 Microgrid Forecasting Best Practices Guide.

📋 Case Connection

📋 ERCOT South Texas Wind Farm Forecast Recalibration

Persistent under-forecasting during cold-air advection events due to mesoscale NWP boundary layer errors

📋 PJM Interconnection Forecast Audit Trail Implementation

Failed FERC audit due to missing provenance for model version deployed during June 2023 heatwave event

📋 Hawaii Island Microgrid Solar Forecast Hardening

Volcanic haze and trade-wind cloud variability caused 30–50% forecast error spikes during monsoon season

📚 References