5. Outlier Detection in Time Series#
Identifying anomalies is a critical step in time series analysis, as outliers can distort statistical measures, bias forecasting models, and reveal significant underlying events. This chapter provides a comprehensive framework for detecting and classifying outliers, moving from fundamental definitions to advanced model-based techniques.
In this chapter, you will learn the following topics:
Outlier Detection Fundamentals: Understanding what constitutes an outlier is the first step toward effective detection. This section defines outliers in the context of time series, explains their impact on data integrity and model accuracy, and demonstrates how to construct synthetic datasets to benchmark detection algorithms under controlled conditions.
Taxonomy of Outliers: Not all anomalies are the same. This section categorizes outliers into three distinct types: Point Outliers (individual extreme values), Contextual Outliers (values that are anomalous only within a specific context, like a heatwave in winter), and Collective Outliers (sequences of data that are unusual as a group). Understanding these categories is essential for selecting the right detection strategy.
Seasonal and Innovative Outliers: Building on the basic taxonomy, this section explores complex outlier types found in periodic data. You will learn to identify Seasonal Outliers, which deviate from expected seasonal patterns, and Innovative Outliers, which represent shocks that have a persistent, decaying effect on the time series, distinguishing them from temporary additive spikes.
Visual Detection Methods: Before applying statistical tests, visualization provides immediate insights into data irregularities. This section covers essential visual tools such as time plots for spotting additive outliers and level shifts, and control charts for monitoring process stability. You will learn how to use these visual methods to generate hypotheses about the nature and cause of anomalies.
Descriptive Statistics-Based Methods: For stationary or transformed data, standard statistical metrics offer a robust detection approach. This section introduces the Z-Score method for normally distributed data, explaining how to interpret standard deviations as anomaly thresholds. It also covers robust alternatives like the Interquartile Range (IQR) for datasets with non-normal distributions.
Time Series Modeling-Based Methods: When data exhibits complex trends and seasonality, simple statistics often fail. This section demonstrates how to use ARIMA models to learn the “normal” behavior of a time series and identify outliers by analyzing forecast errors. This model-driven approach allows for the detection of subtle anomalies that simpler methods might miss.
- 5.1. Outlier Detection in Time Series
- 5.2. Outlier Classification by Scope
- 5.3. Outlier Classification by Seasonality
- 5.4. Visual Methods for Outlier Detection
- 5.5. Descriptive Statistics-Based Methods for Outlier Detection in Time Series
- 5.6. Time Series Modeling-Based Methods for Outlier Detection