Median Absolute Deviation Calculator

Enter a list of numbers to calculate the Median Absolute Deviation and view it on the plot.

Median:

Median Absolute Deviation (Median AD):

Understanding Median Absolute Deviation (Median AD)

The Median Absolute Deviation (Median AD) is a measure of the variability of data points around the median. It is particularly useful as a robust measure of spread, especially in datasets that may contain outliers or are not symmetrically distributed.

Formula for Median Absolute Deviation

The formula for calculating Median AD is:

\[ \text{Median AD} = \text{median}(|x_i - \text{median}(x)|) \]

where \( x_i \) represents each data point, and \( \text{median}(x) \) is the median of the data.

Why Use Median AD Instead of Mean AD?

Median AD is often preferred over Mean AD when the data set contains outliers or is skewed. Here’s why:

  • Robustness to Outliers: Since Median AD is based on the median, it is less affected by extreme values than Mean AD, which is calculated around the mean. In datasets with significant outliers, Median AD provides a more accurate reflection of the central tendency of typical values.
  • Non-Symmetric Distributions: Median AD is ideal for data that are not symmetrically distributed. For example, in financial data or data with a skewed distribution, Median AD offers a reliable measure of spread around the central value without being overly influenced by large deviations.

Example: Calculating Median AD and Mean AD with an Outlier

Consider the following dataset:

\[ 12, 15, 14, 13, 14, 15, 100 \]

This dataset contains an outlier (100), which significantly deviates from the other values.

Step-by-Step Calculation of Mean AD

To calculate Mean Absolute Deviation, we first find the mean of the dataset:

\[ \text{Mean} = \frac{12 + 15 + 14 + 13 + 14 + 15 + 100}{7} = 26.14 \]

Next, we find the absolute deviations from the mean for each data point:

  • \(|12 - 26.14| = 14.14\)
  • \(|15 - 26.14| = 11.14\)
  • \(|14 - 26.14| = 12.14\)
  • \(|13 - 26.14| = 13.14\)
  • \(|14 - 26.14| = 12.14\)
  • \(|15 - 26.14| = 11.14\)
  • \(|100 - 26.14| = 73.86\)

Now, we calculate the Mean AD by taking the average of these absolute deviations:

\[ \text{Mean AD} = \frac{14.14 + 11.14 + 12.14 + 13.14 + 12.14 + 11.14 + 73.86}{7} = 27.02 \]

Step-by-Step Calculation of Median AD

To calculate Median Absolute Deviation, we first find the median of the dataset:

\[ \text{Median} = 14 \]

Next, we find the absolute deviations from the median for each data point:

  • \(|12 - 14| = 2\)
  • \(|15 - 14| = 1\)
  • \(|14 - 14| = 0\)
  • \(|13 - 14| = 1\)
  • \(|14 - 14| = 0\)
  • \(|15 - 14| = 1\)
  • \(|100 - 14| = 86\)

Now, we calculate the Median AD by finding the median of these absolute deviations:

\[ \text{Median AD} = \text{median}(2, 1, 0, 1, 0, 1, 86) = 1 \]

Results

  • Mean AD: 27.02
  • Median AD: 1

This example demonstrates that while the Mean AD is heavily influenced by the outlier (100), resulting in a value of 27.02, the Median AD remains stable at 1, reflecting the typical spread around the central values more accurately.

Implementations

Profile Picture
Senior Advisor, Data Science | [email protected] | + posts

Suf is a senior advisor in data science with deep expertise in Natural Language Processing, Complex Networks, and Anomaly Detection. Formerly a postdoctoral research fellow, he applied advanced physics techniques to tackle real-world, data-heavy industry challenges. Before that, he was a particle physicist at the ATLAS Experiment of the Large Hadron Collider. Now, he’s focused on bringing more fun and curiosity to the world of science and research online.