# Extreme outliers

The percentage of monthly values that are not extreme outliers, and of districts with no extreme outliers in the year.

An *extreme outlier* (A monthly value more than 5 times the median absolute deviation (MAD) from the median monthly value of the same series (district, or the national or admin-1 series being assessed), the median and MAD being computed from all years except the most recent one (source). In data adjustment it is replaced by the median of the district's non-outlier months in the same year.) is a monthly number far from the usual values of the
same district, such as an accidental extra zero. Most are data errors; some are real events, such as a vaccination
campaign.

> **Note**
>
> **At a glance**
> - **Measures:** the share of monthly values, and of districts, without extreme outliers.
> - **Good result:** at least 99% of monthly values, and 90% of districts, without extreme outliers.
> - **In the app:** the **[Outlier Detection](https://datasuite.damurka.com/en/apps/countdown/data-quality/outlier-detection.md)** page of the data quality pages.

## Why

Extreme outliers, such as an accidental extra zero in a number, can have a large impact, especially on subnational
numbers: a single wrong month can change a district's annual total, and its
*coverage* (The population who received the service divided by the population who need it (the target population).), considerably.

## What

A monthly value is an extreme outlier when it is more than 5 times the
*median absolute deviation (MAD)* (How much the values of a series usually differ from their median: the median of the distances between each value and the median. A monthly value more than 5 MAD from the median is an extreme outlier.) away from the
*median* (The middle value of a series once sorted: half the values are above it, half below. A few extreme values barely move it, unlike the mean.) monthly value of the same district. The median and MAD are computed from all
years except the most recent one, so the latest year is judged against the earlier years.

| Indicator | Numerator | Denominator | Interpretation |
| --- | --- | --- | --- |
| % of monthly values that are not extreme outliers (national) | Number of monthly values that are not extreme outliers in a specific year | Total number of monthly values | At least 99% of monthly data expected not to be an extreme outlier; consider reasons |
| % of districts with no extreme outliers in a year | Number of districts with no extreme outliers in a specific year | Total number of districts | At least 90% of districts should have no extreme outliers at all; consider reasons |

## Formula

A monthly value $x$ is an extreme outlier when

$$\lvert x - m \rvert > 5 \times MAD$$

$$\text{Values without outliers} = \frac{V_{ok}}{V} \times 100$$

$$\text{Districts without outliers} = \frac{D_{ok}}{D} \times 100$$

where

- $m$ is the median monthly value of the district, over all years except the most recent;
- $MAD$ is the median absolute deviation of the same values;
- $V_{ok}$ is the number of monthly values in the year that are not extreme outliers, and $V$ the number of monthly values;
- $D_{ok}$ is the number of districts with no extreme outlier in the year, and $D$ the total number of districts.

**Worked example:** a district's monthly values have a median of 100 and a MAD of 10. Values from 100 − 5 × 10 = **50**
to 100 + 5 × 10 = **150** are normal; a month with 1,000 is an extreme outlier.

## Settings

| Setting | Default | What it means |
| --- | --- | --- |
| Outlier bound | 5 × MAD | How far from the median a monthly value must be to count as an extreme outlier. |
| Baseline years | All years except the latest | The years used for the median and MAD, so the latest year cannot hide its own outliers. |

## Interpretation

- **Are at least 99% of monthly values, and 90% of districts, free of extreme outliers?** If not, find which districts and indicators the outliers come from.
- **Is there a real-world explanation?** Outliers are found by a statistical rule. A campaign, a stock-out or an outbreak can produce a real peak; consider the reasons before treating a value as an error.
- **Is it a single month?** A peak that falls back the next month is typical of a typing error, or of a campaign. Look at the trend around it.
- **Are many outliers in one year?** That suggests a reporting problem in that year.

### Example: monthly values without outliers, by area and year

![Percentage of monthly values that are not extreme outliers, by Admin 1 area and year](https://datasuite.damurka.com/images/dqa-out-outliers-heatmap.png)

**Reading the chart:** each column is an *Admin 1* (The first level below the national level, such as a region, province or department. Districts (Admin 2) are the level below it.) area and each row a year; the
number is the percentage of monthly values that are not extreme outliers. Green is 90% or more.

**What it shows:** every area has 100% of its monthly values free of extreme outliers in every year: no outlier problem
at this level for this indicator. A few outliers in single districts can still disappear in a rounded area average, so
the app also lists the districts and months concerned.

### Example: one district's months against the band of normal values

![Monthly values for one district, with the band of normal values (median ± 5 MAD)](https://datasuite.damurka.com/images/dqa-out-outlier-trend.png)

**Reading the chart:** the green line is the reported value each month; the grey band is the range of normal values
(median ± 5 MAD) and the dashed line the median. A month outside the band would be an extreme outlier.

**What it shows:** the band runs from about 50 to about 1,260 and the median is about 650. Every month lies inside the
band, including the peak in March (about 680), so none is an extreme outlier.

## After the assessment

In [Data adjustment](https://datasuite.damurka.com/en/methodology/data-adjustment.md), extreme monthly outliers are corrected and given the district's
median value for the same year. See
[Replacing outliers and missing values](https://datasuite.damurka.com/en/methodology/data-adjustment/extreme-outliers.md#formula).
