Decomposing Seasonality
You'll learn how S-H-ESD separates seasonal patterns from trend and remainder to isolate true anomalies from expected fluctuations.
When hunting for anomalies in time series data, you face a tricky challenge: not every spike or dip is unusual. Some patterns repeat predictably—like higher ice cream sales every summer or web traffic surges every Monday morning. Seasonal Hybrid ESD (S-H-ESD) tackles this by first decomposing your data into three components before looking for anomalies.
The Three Components
Think of your time series like a song with multiple instruments:
- Trend: The long-term direction (like a bass line)—is the metric generally rising, falling, or stable?
- Seasonality: Regular, repeating patterns (like a drum beat)—daily, weekly, monthly cycles
- Remainder (or residual): Everything left over (like improvisations)—the noise and potential anomalies
Why Decompose First?
Without decomposition, a normal seasonal peak might trigger a false alarm. Imagine detecting anomalies in retail sales without accounting for the December holiday surge—you'd flag every Christmas as "abnormal"!
S-H-ESD uses STL (Seasonal and Trend decomposition using LOESS) or similar methods to extract seasonality and trend, leaving behind the remainder. Then it applies the ESD (Extreme Studentized Deviate) test only to the remainder. This way, a spike is only flagged as anomalous if it's unusual after accounting for expected seasonal behavior.
The Process
- Decompose the time series into trend + seasonal + remainder
- Apply anomaly detection (ESD) to the remainder only
- Any detected anomalies represent true deviations, not just seasonal effects
Key Takeaway: S-H-ESD decomposition separates what's predictably periodic from what's genuinely anomalous, preventing seasonal patterns from masking real issues or triggering false alarms.