Seasonal Hybrid ESD (S-H-ESD) is a statistical algorithm that detects anomalies in time series data by first decomposing the series into seasonal, trend, and residual components using Seasonal-Trend decomposition using LOESS (STL), then applying the Generalized Extreme Studentized Deviate (ESD) test to the residual component to identify statistically significant outliers. This hybrid approach ensures that recurring seasonal patterns and long-term trends are not mistakenly flagged as anomalies, enabling robust detection of both global outliers and subtle local deviations within a cyclical context.
Glossary
Seasonal Hybrid ESD (S-H-ESD)

What is Seasonal Hybrid ESD (S-H-ESD)?
A statistical algorithm for anomaly detection in time series that combines time series decomposition to handle seasonality and trend with the Generalized Extreme Studentized Deviate test to robustly identify both global and local anomalies.
The algorithm's strength lies in its ability to handle the seasonality and trend inherent in financial transaction volumes, which naturally fluctuate by day of week or hour of day. By isolating the residual component—the noise left after removing predictable patterns—the ESD test can accurately identify additive outliers and level shifts that represent genuine anomalous behavior, such as a sudden spike in transaction amounts during an otherwise low-activity period, without requiring manual threshold tuning.
Key Characteristics of S-H-ESD
Seasonal Hybrid ESD combines classical time series decomposition with robust statistical testing to detect anomalies in data exhibiting both trend and seasonal patterns.
Two-Stage Decomposition Pipeline
S-H-ESD first decomposes the time series using STL (Seasonal-Trend decomposition using LOESS) to extract the seasonal and trend components. The remaining residual component represents the de-trended and de-seasonalized signal, isolating the noise and anomalous deviations from the expected pattern. This preprocessing step is critical for preventing seasonal peaks from being falsely flagged as anomalies.
Generalized ESD Test Core
The algorithm applies the Generalized Extreme Studentized Deviate (GESD) test to the residual component. Unlike Grubbs' test, GESD can detect multiple anomalies in a single pass by iteratively removing the most extreme value and recalculating the test statistic against a critical value that adjusts for the remaining sample size. This avoids the masking effect where one extreme outlier hides another.
Robustness to Seasonality
A defining characteristic is its explicit handling of periodic patterns. By modeling and removing seasonality before testing, S-H-ESD avoids the high false positive rates that plague simpler methods like static thresholding or raw Z-score analysis when applied to data with daily, weekly, or monthly cycles. The LOESS-based decomposition adapts to changing seasonal amplitudes over time.
Local vs. Global Anomaly Detection
S-H-ESD can be configured to detect both global anomalies (extreme spikes relative to the entire series) and local anomalies (subtle deviations within a seasonal neighborhood). By adjusting the window size for the median and seasonal extraction, the algorithm can focus on short-term contextual outliers that would be invisible to aggregate statistical methods.
Statistical Significance Control
The algorithm provides a formal alpha-level significance parameter that directly controls the false positive rate. Each candidate anomaly is tested against a critical value derived from the t-distribution with a Bonferroni-like correction for multiple testing. This gives fraud analysts a mathematically rigorous confidence bound rather than an arbitrary threshold score.
Streaming and Batch Adaptability
While originally designed for batch analysis, S-H-ESD can be adapted for streaming anomaly detection by applying a sliding window approach. The decomposition and GESD test are recomputed on each new window of data, enabling near-real-time fraud monitoring. This makes it suitable for both retrospective forensic analysis and operational alerting pipelines.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Frequently Asked Questions
Clear, technically precise answers to the most common questions about the Seasonal Hybrid ESD algorithm for time-series anomaly detection.
Seasonal Hybrid ESD (S-H-ESD) is a statistical algorithm for anomaly detection in time series that combines time series decomposition to handle seasonality and trend with the Generalized Extreme Studentized Deviate (ESD) test to robustly identify both global and local anomalies. The algorithm first decomposes the series into seasonal, trend, and residual components using STL decomposition (Seasonal-Trend decomposition using LOESS). The ESD test is then applied iteratively to the residual component, which represents the noise after removing systematic patterns. This hybrid approach prevents seasonal peaks and troughs from being falsely flagged as anomalies, a common failure mode of standard ESD. The test uses a statistical hypothesis framework with a controlled false positive rate (alpha), making it particularly suitable for financial fraud detection where seasonal transaction volumes must be accounted for.
Related Terms
Core statistical and machine learning concepts that underpin the Seasonal Hybrid ESD algorithm, enabling robust time series anomaly detection in financial fraud applications.
Generalized Extreme Studentized Deviate (GESD)
The foundational statistical test at the heart of S-H-ESD. GESD is an iterative procedure that tests for up to a user-specified number of outliers in a univariate dataset that approximately follows a normal distribution.
- Mechanism: Computes the R-statistic (max deviation from the mean divided by standard deviation) and compares it against a critical value derived from the t-distribution.
- Iterative Masking: After identifying the most extreme point, it is removed and the test is reapplied to the remaining data, preventing the masking effect where one outlier hides another.
- Key Advantage: Unlike Grubbs' Test, GESD does not require the exact number of outliers to be known in advance, only an upper bound.
Time Series Decomposition
The preprocessing step that makes GESD applicable to seasonal data. S-H-ESD uses Seasonal-Trend decomposition using LOESS (STL) to break a time series into three additive components:
- Trend (T_t): The long-term, low-frequency variation in the data, such as a gradual increase in transaction volume.
- Seasonal (S_t): The repeating, fixed-period pattern, like increased retail spending on weekends or holidays.
- Residual (R_t): The remaining noise after removing trend and seasonality. Anomaly detection is performed on this residual component, as it represents the deviation from the expected pattern.
Extreme Value Theory (EVT)
A statistical discipline that provides the theoretical justification for setting robust anomaly thresholds. Instead of assuming a full data distribution, EVT focuses on modeling the behavior of the tail of the distribution.
- Peaks Over Threshold (POT): A common EVT method that fits a Generalized Pareto Distribution (GPD) to all data points exceeding a high threshold.
- Relation to S-H-ESD: While S-H-ESD uses the t-distribution for its critical values, EVT offers an alternative, mathematically rigorous way to control the false positive rate by modeling the extreme residuals directly, which is critical for financial risk management.
Change Point Detection
A complementary analytical task that identifies abrupt shifts in the statistical properties of a time series, such as a sudden change in the mean or variance. While S-H-ESD identifies individual anomalous points, change point detection finds the moment when the system's behavior fundamentally changed.
- PELT Algorithm: A common method that searches for optimal segmentation points by minimizing a cost function with a penalty for over-segmentation.
- Synergy: In fraud systems, a detected change point (e.g., a new fraud campaign starting) can be used to segment the data before applying S-H-ESD, ensuring the model adapts to the new regime rather than flagging the entire new pattern as anomalous.
Dynamic Thresholding
A strategy for adapting anomaly detection sensitivity over time, moving beyond a single static cutoff. This is essential for financial data where volatility is non-constant (heteroskedasticity).
- Rolling Window Statistics: Thresholds are computed based on the mean and standard deviation of anomaly scores from a recent historical window (e.g., the past 30 days).
- Integration with S-H-ESD: The critical value in the GESD test can be made dynamic by scaling it based on the current volatility regime, reducing false positives during high-variance periods like market holidays and increasing sensitivity during stable, low-activity periods.
Matrix Profile
A data structure for time series that annotates every subsequence with its distance to its nearest non-self match. It is a powerful, all-in-one tool for discovering discords (anomalies) and motifs.
- Discord Discovery: The subsequence with the largest distance to its nearest neighbor is the top discord, representing the most anomalous pattern in the series.
- Contrast with S-H-ESD: Matrix Profile excels at finding anomalous shapes or motifs in a sequence, while S-H-ESD excels at finding anomalous values relative to a seasonal baseline. They are often used together for comprehensive time series analysis in fraud detection.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us