# Anomaly Detection

**Category:** metrics  
**Short Description:** The systematic process of identifying data points that significantly deviate from expected patterns and thresholds.  
**Last Updated:** 2026-07-07T00:00:00Z

## Definition

Anomaly detection is the systematic process of identifying data points that deviate significantly from expected patterns using statistical methods and machine learning. In digital advertising, it's crucial for detecting performance issues, fraud, tracking problems, and other irregularities that require immediate attention. The process typically involves establishing baseline performance patterns, setting statistical thresholds, and automatically flagging deviations that exceed normal variance ranges.

## Formula

**Formula:** `z = (x − μ) / σ`
**Result Unit:** ratio

How many standard deviations today's value sits from its historical average — beyond ±2 or ±3 gets flagged as an anomaly.

## Calculation

**Formula:** `Typically uses statistical methods like Z-score (z = (x - μ) / σ) or machine learning models`

**Explanation:** Compares current values against historical patterns, flagging significant deviations based on standard deviations or learned patterns. Common thresholds include ±2 or ±3 standard deviations from the mean.

### Components

- **Current Value**: The metric value being evaluated
- **Mean**: The mean of historical values within the comparison window
- **Standard Deviation**: The standard deviation of historical values

## Examples

- Daily CPA averaging $40 with a $5 standard deviation spikes to $58: z = (58 − 40) / 5 = 3.6 — beyond the ±3σ threshold, so the day is flagged for investigation
- Detecting sudden CPC spikes indicating auction manipulation
- Identifying unusual conversion patterns suggesting tracking issues
- Monitoring for sudden drops in conversion tracking

## How AdSights Helps

**Tracking Anomaly Detection:** AdSights applies anomaly detection at the creative level, where account dashboards average problems away. A fatiguing hook or broken variant can hide inside a healthy campaign aggregate for weeks; per-variant baselines surface the specific ad whose CTR or CPA broke from its own history, days before the blended numbers move.

## FAQs

### How does anomaly detection work in digital advertising?

Three steps: establish a baseline of what's normal (a rolling mean and standard deviation, or a moving average, over a recent window), score each new value against it (most simply a z-score — how many standard deviations it sits from the mean), and flag values beyond a threshold, typically ±2σ or ±3σ. Sophisticated systems layer on seasonality models and machine learning, but the core logic is the same: measure the deviation, judge whether normal noise explains it.

### What threshold should I use for anomaly detection?

It's a trade-off between false alarms and missed problems. A ±2σ threshold flags roughly 5% of perfectly normal days — sensitive, but the false alarms add up across a large account. A ±3σ threshold flags only ~0.3% of normal days but reacts later to slow drifts. A common pattern: ±3σ for automated actions like pausing, ±2σ for human-review alerts, tuned by how costly a miss is versus a wasted investigation.

### Why does my anomaly detection produce so many false alarms?

Usually one of three causes. Thresholds too tight for the metric's real volatility — a ±2σ rule on a jumpy prospecting CPA fires constantly. Unmodeled seasonality — weekends and promos look anomalous against a flat baseline, so compare against same-day-of-week history. Or small samples — a low-volume ad set's daily conversion rate can legitimately swing 50%+, so score anomalies on aggregated windows instead of raw daily values.

### Do I need machine learning for anomaly detection?

No — for most advertising use cases, a z-score against a rolling 28-day baseline with day-of-week adjustment catches the anomalies that matter: tracking breaks, auction shocks, budget runaways, fatigue inflections. Machine learning earns its keep with multi-seasonal patterns or scale where per-metric tuning is impractical. Start statistical; add ML when the simple model's false-alarm or miss rate provably costs money.

## Related Terms

### Component Terms

- **[Standard Deviation](/resources/glossary/metrics/standard-deviation)**: Helps establish normal ranges for anomaly detection
- **[Moving Average](/resources/glossary/metrics/moving-average)**: Provides baseline for detecting deviations
- **[Statistical Significance](/resources/glossary/metrics/statistical-significance)**: Helps validate if detected anomalies are statistically meaningful
- **[Variance](/resources/glossary/metrics/variance)**: Helps establish expected ranges of fluctuation
- **[False Positive](/resources/glossary/metrics/false-positive)**: Looser anomaly thresholds raise the false-alarm rate — the core tuning trade-off
- **[False Negative](/resources/glossary/metrics/false-negative)**: Stricter thresholds let real problems slip through undetected
