Median Absolute Deviation: Formula and Worked Example

By Dr. Zubair Khalid, DVM, MS, PhD ·

Median Absolute Deviation: Formula and Worked Example

The median absolute deviation (MAD) is a measure of how spread out a set of numbers is. It answers a simple question: on a typical day, how far do my measurements sit from the middle value? You compute the median of the data, measure how far each value sits from that median, and then take the median of those distances.

By the end of this guide you will be able to calculate MAD by hand on a small dataset, understand what absolute deviation means, tell the difference between MAD, mean absolute deviation, and average absolute deviation, and decide when MAD is a better choice than the standard deviation. You need nothing more than a pencil, paper, and a dataset of five to nine numbers. A basic calculator helps, but you can finish every step in your head.

This matters across laboratory science, quality control, and data analysis. When a dataset contains outliers, an extreme value, or a contaminated sample, the standard deviation can be pulled far away from the truth. MAD resists that pull. Robust dispersion estimators like MAD are now standard tools in analytical chemistry, quality control, eye tracking, and genomics [1][2][3].

What Absolute Deviation Means

Absolute deviation is the distance between one value and a reference point, written as a positive number. If your reference point is the median and a measurement is 12 while the median is 10, the absolute deviation is 2. If a measurement is 8 while the median is 10, the absolute deviation is also 2. Direction does not matter. Only distance matters.

The word "absolute" refers to the absolute value function, which strips away the sign. A deviation of negative 4 becomes positive 4. This is why absolute deviation never cancels out the way signed deviations do. If you add signed deviations around the mean, they always sum to zero, which is useless as a spread measure. Absolute values solve that problem.

The reference point can be the mean, the median, or any other anchor you choose. The choice of anchor changes the name of the statistic and changes how sensitive it is to outliers. That single decision, mean versus median, is the heart of this entire topic.

The Median Absolute Deviation Formula

Boxplot showing a data distribution with no outliers marked
A boxplot with no outliers helps illustrate how MAD measures spread around the median without being skewed by extreme values. Image: Ever.chae, CC BY-SA 4.0, via Wikimedia Commons.

The formula has two stages.

Stage 1: Find the median of the data, written as x̃ (x-tilde).

Stage 2: For each value xᵢ, compute the absolute deviation |xᵢ - x̃|. Then take the median of those absolute deviations.

In symbols:

MAD = median( |xᵢ - x̃| )

That is the whole formula. There is no division by n, no square root, no squaring. You sort, subtract, take absolute values, and sort again.

The median is the middle value of an ordered list. With an odd number of values, it is the single middle entry. With an even number, it is the average of the two middle entries. The same rule applies both times you compute a median: once on the raw data, once on the absolute deviations.

Worked Example: MAD on Seven Values

Take a small dataset of seven measurements. These could be replicate readings of a concentration, reaction times, or pixel intensities. Units are arbitrary here, but keep them in mind because MAD carries the same units as the original data.

Dataset: 10, 12, 12, 13, 14, 15, 30

That final value, 30, is a plausible outlier. Watch what it does to MAD versus the standard deviation later.

Step 1: Sort the data

10, 12, 12, 13, 14, 15, 30

Sorting is required because the median depends on position, not on the raw order of collection.

Step 2: Find the median

There are 7 values, which is odd. The median is the 4th value in the sorted list.

Position of median = (n + 1) / 2 = (7 + 1) / 2 = 4

The 4th value is 13. So x̃ = 13.

Step 3: Compute each absolute deviation from the median

Subtract 13 from every value and drop the sign.

Value (xᵢ)Deviation from median (xᵢ - 13)Absolute deviation \xᵢ - 13\
10-33
12-11
12-11
1300
14+11
15+22
30+1717

The last row shows the outlier's effect. Its absolute deviation is 17, far larger than everything else. But notice that this single large number does not yet dominate the final answer, because the next step uses the median rather than the mean.

Step 4: Take the median of the absolute deviations

The list of absolute deviations is:

3, 1, 1, 0, 1, 2, 17

Sort it:

0, 1, 1, 1, 2, 3, 17

There are 7 values, so the median is again the 4th value.

Position of median = (7 + 1) / 2 = 4

The 4th value is 1.

MAD = 1

The typical distance of a measurement from the median is 1 unit. Six of the seven values sit within 2 units of the median. The outlier sits 17 units away, yet it barely moved the final answer. That is the defining property of MAD.

Step 5: Check the result

A quick sanity check: count how many absolute deviations fall below the MAD, how many equal it, and how many exceed it. Here, three values (0, 1, 1) are below or equal to 1 on the low side, one equals 1, and three exceed it (2, 3, 17). The median sits in the middle of the ordered deviations, which is exactly what you expect. If your MAD came out smaller than the smallest absolute deviation or larger than the largest, you made an arithmetic error.

Step 6: Convert to a standard deviation equivalent (optional)

Under a normal distribution, MAD and the standard deviation are related by a fixed scaling factor. To make MAD a consistent estimator of the standard deviation, multiply by 1.4826:

σ̂ = 1.4826 × MAD

For this example: σ̂ = 1.4826 × 1 = 1.4826.

The scaled value, roughly 1.48, is an estimate of what the standard deviation would be if the data were normal and outlier-free. The raw MAD stays at 1. The scaling constant does not change the units, only the interpretation.

The Full Formula Table

QuantityFormulaReference pointResistant to outliers?
Median absolute deviation (MAD)median(\xᵢ - x̃\)MedianYes, high resistance
Mean absolute deviation(1/n) Σ \xᵢ - x̄\MeanNo, low resistance
Average absolute deviationSame as mean absolute deviationMean (usually)No, low resistance
Standard deviation (SD)√[(1/(n-1)) Σ (xᵢ - x̄)²]MeanNo, very low resistance
Scaled MAD1.4826 × MADMedianYes, high resistance

The table makes one thing clear. MAD and mean absolute deviation share the idea of absolute distance, but they differ in the anchor. MAD anchors on the median. Mean absolute deviation anchors on the mean.

MAD Versus Mean Absolute Deviation: The Key Distinction

The mean absolute deviation definition is straightforward: it is the average of the absolute deviations from the mean. You compute the mean, subtract it from every value, take absolute values, add them up, and divide by the number of values.

Using the same dataset (10, 12, 12, 13, 14, 15, 30):

Mean = (10 + 12 + 12 + 13 + 14 + 15 + 30) / 7 = 106 / 7 ≈ 15.14

Absolute deviations from the mean:

ValueDeviation from mean (xᵢ - 15.14)Absolute deviation
10-5.145.14
12-3.143.14
12-3.143.14
13-2.142.14
14-1.141.14
15-0.140.14
30+14.8614.86

Sum of absolute deviations = 5.14 + 3.14 + 3.14 + 2.14 + 1.14 + 0.14 + 14.86 = 29.70

Mean absolute deviation = 29.70 / 7 ≈ 4.24

Compare the two answers on the same data:

  • MAD = 1
  • Mean absolute deviation ≈ 4.24

The outlier at 30 dragged the mean up to 15.14, which pushed every other value's deviation upward. The mean absolute deviation is more than four times larger than MAD. It is reporting the outlier's influence, not the typical spread of the bulk of the data.

Average absolute deviation: a naming caution

Average absolute deviation is often used as a synonym for mean absolute deviation. Some texts use it more loosely to mean any average of absolute deviations, whether around the mean, the median, or another center. When you read the term, check which center the author used. If the center is the median and the averaging is done by median rather than mean, you have MAD. If the center is the mean and the averaging is done by the arithmetic mean, you have mean absolute deviation. The names overlap, so the formula is the reliable guide.

A useful rule: the word "mean" in "mean absolute deviation" tells you the averaging step uses the arithmetic mean. The word "median" in "median absolute deviation" tells you both the center and the averaging step use the median. MAD is a median of medians, in a sense.

How to Find MAD: A Repeatable Procedure

The steps generalize to any dataset. Follow them in order.

  1. Sort the data from smallest to largest.
  2. Find the median of the sorted data. For odd n, take the middle value. For even n, average the two middle values.
  3. Subtract the median from every original value.
  4. Take the absolute value of each difference.
  5. Sort the absolute deviations.
  6. Find the median of the sorted absolute deviations. That is MAD.
  7. Optionally multiply by 1.4826 to express the result on a standard deviation scale.

For a median absolute deviation calculator, these are the exact operations it performs. If you ever get a different answer from a calculator, walk through these seven steps by hand and find where the two diverge. The most common divergence is the even-n case, where people forget to average the two middle values.

Even-numbered example

Take six values: 4, 7, 7, 9, 11, 40.

Sorted: 4, 7, 7, 9, 11, 40

Median of 6 values = average of 3rd and 4th = (7 + 9) / 2 = 8

Absolute deviations from 8:

ValueDeviationAbsolute deviation
4-44
7-11
7-11
9+11
11+33
40+3232

Sorted absolute deviations: 1, 1, 1, 3, 4, 32

Median of 6 values = average of 3rd and 4th = (1 + 3) / 2 = 2

MAD = 2

Scaled MAD = 1.4826 × 2 = 2.9652

Even with a value of 40 in a dataset whose other values sit between 4 and 11, MAD stays at 2. The outlier is present but does not dominate.

Units: MAD Carries the Same Units as the Data

MAD is expressed in the same units as the original measurements. If your data are in milligrams per liter, MAD is in milligrams per liter. If your data are in milliseconds, MAD is in milliseconds. If your data are in degrees Celsius, MAD is in degrees Celsius.

This is true because MAD is built entirely from subtraction and ordering. You subtract the median from each value, and subtraction preserves units. You then take a median, which is just a selected value from the same list, so the units carry through unchanged. No squaring, no square root, no division by a count that would create a unitless ratio.

The scaling constant 1.4826 is also unitless. Multiplying by it changes the number but not the unit. So a scaled MAD is still in the original units. This is a genuine convenience. You can report MAD alongside the median and the reader knows exactly how to interpret it, because everything is in the same unit.

Contrast this with the coefficient of variation, which divides the standard deviation by the mean and produces a unitless ratio. MAD does not do that. If you need a unitless relative measure, you divide MAD by the median yourself and interpret the result as a proportion.

Why 1.4826? The Consistency Constant

Raw MAD and standard deviation measure spread on different scales. For normally distributed data, MAD tends to be smaller than the standard deviation by a predictable factor. Multiplying MAD by approximately 1.4826 aligns the two scales so that MAD becomes a consistent estimator of the standard deviation under normality.

The constant comes from the normal distribution's geometry. It is the reciprocal of the 75th percentile of the standard normal distribution, which works out to roughly 1.4826. You do not need to derive it. You only need to remember when it applies and when it does not.

Apply the constant when:

  • You believe the underlying data are approximately normal.
  • You want to report a robust estimate of the standard deviation.
  • You want to compare MAD directly against an SD computed on the same data.

Do not apply the constant when:

  • You are reporting raw MAD as a standalone spread measure.
  • The data are strongly non-normal, such as heavily skewed or bimodal.
  • You are using MAD purely as a threshold for outlier detection, where the raw value is the natural unit.

The distinction matters because the scaled value answers a different question. Raw MAD tells you the typical distance from the median. Scaled MAD tells you what the standard deviation would be if the data were normal. Both are useful, but they are not interchangeable.

Robustness: The 50% Breakdown Point

The breakdown point of an estimator is the smallest fraction of data that, if replaced with arbitrary extreme values, can make the estimate arbitrarily wrong. The standard deviation has a breakdown point of essentially zero. A single wild value can inflate it without limit.

MAD has a breakdown point of 50%. You would need to corrupt more than half the data before MAD could be pushed to an arbitrary value. This is the highest breakdown point any location or scale estimator can achieve, because once more than half the data are corrupted, you can no longer tell which half is the truth.

The worked example shows this in miniature. The value 30 sits far from the rest, yet MAD stayed at 1. If you replaced 30 with 3,000, the sorted absolute deviations would become 0, 1, 1, 1, 2, 3, 2987, and the median would still be 1. MAD does not move. The standard deviation on the same data would explode.

This property is why MAD appears in real analytical workflows. A robust ΔΔct estimate for gene expression uses median and MAD to aggregate replicates, and simulations show it produces shorter confidence intervals and better coverage than the non-robust alternative when outliers are present [3]. Saccade detection in eye-tracking data uses MAD to set velocity thresholds, because mean-and-SD thresholds are influenced by the very saccades they are trying to detect [2]. The Hampel filter, a standard tool for outlier replacement in time series, is built around MAD [4].

When to Prefer MAD Over SD

Choose MAD when any of the following is true.

The data contain outliers or contamination. Real measurements pick up spikes, transcription errors, and instrument glitches. MAD ignores their leverage on the spread estimate. The robust ΔΔct work demonstrates this directly: with outliers present, the MAD-based estimate gave significantly reduced confidence interval length and coverage close to the nominal level [3].

The distribution is skewed or non-normal. Standard deviation assumes symmetry around the mean. When the data are skewed, the mean is pulled toward the tail, and SD misrepresents the spread of the bulk. MAD anchors on the median, which is less affected by skew.

You are screening data for quality. MAD is a common basis for univariate outlier flags. Values more than a few MADs from the median are candidates for review. The NDNQI nursing quality database comparison found that ad-hoc robust scale estimators including MAD were fast, easy to implement, and could be more robust and efficient than a theoretically based method, depending on the distribution of the measure [5].

You are setting detection thresholds. In neural signal detection, the baseline is established first, then its MAD is used to detect spontaneous signals as outliers from the noise distribution, with the threshold chosen in units of MAD to trade off false positives and false negatives [6].

You want a spread measure that matches the median. If you report the median as your center, MAD is the natural companion. Mixing a median with a standard deviation is inconsistent, because the two statistics assume different things about the data.

Choose the standard deviation when the data are clean, roughly symmetric, and you need the mathematical properties that only SD provides, such as additivity of variances across independent sources. Choose mean absolute deviation when you want an average distance from the mean and you are confident no outliers are present. Choose MAD when robustness is the priority.

MAD in Practice Across Life Science

MAD shows up wherever measurement noise and outliers coexist.

In process control, a CUSUM control chart based on MAD with trimming and winsorization outperformed alternatives across normal and contaminated data, remaining sensitive to small shifts in magnitude [7]. In clinical laboratory quality control, MAD around the median was used to build an alternative average-of-normals procedure that could handle datasets containing qualitative values below the limit of detection [8]. In analytical method validation, MAD and the Huber estimator are taught as robust alternatives to the usual centralization and dispersion estimators for detecting outliers [1].

In instrument precision assessment, MAD estimated precision from parked collocation data for mobile air quality measurements, where a standard deviation would have been distorted by the same spikes the instruments were measuring [9]. In spatial transcriptomics, MAD-based outlier detection combined with morphology operations identifies tissue artifacts such as dry patches and uneven reagent coverage [10]. In photoacoustic imaging, a median and MAD statistical noise baseline isolates biological signal from scattering spikes and optical artifacts [11].

In genomics, MAD underpins a feature selection method that identifies discriminative genes by scoring class overlap, and it outperformed several state-of-the-art alternatives across eleven gene expression datasets [12]. In high-throughput RNA interference screening, a median plus k times MAD rule selected a number of hits close to a quartile-based method, and both were more robust than mean plus k SD [13]. In process capability analysis under a Weibull process, the MAD method performed better than alternatives under low and moderate asymmetry [14].

The pattern is consistent. Whenever a dataset can contain values that are real but extreme, or wrong but present, MAD gives a spread estimate that reflects the bulk of the data rather than the extremes.

Common Mistakes and Limitations

Using the mean instead of the median as the anchor. The most frequent error is computing absolute deviations from the mean and calling the result MAD. That is mean absolute deviation, a different statistic with different properties. Check your anchor before you subtract.

Forgetting to take absolute values. If you keep the signs, the deviations sum to zero around the median and the median of signed deviations is also zero. The absolute value step is not optional.

Averaging instead of taking the median in the final step. Some people compute the mean of the absolute deviations and label it MAD. That produces mean absolute deviation again. The final step must be a median.

Mishandling even sample sizes. With an even number of values, both medians require averaging the two middle entries. Skipping this step shifts the result.

Applying the 1.4826 constant to non-normal data. The constant assumes normality. On heavily skewed or bimodal data, the scaled value is not a meaningful standard deviation estimate. Report raw MAD instead.

Assuming MAD is always the right choice. MAD discards information by ignoring the magnitude of extreme values. If your outliers are genuine and important, such as a real disease signal, MAD will hide them. Use it for robust spread estimation, not for detecting whether extremes exist. Pair it with a visualization.

Confusing MAD with median absolute deviation from the mean. Some older literature uses "MAD" for the median of absolute deviations from the mean. The modern convention, and the one used throughout the robust statistics literature cited here, anchors on the median [5][1].

Reporting MAD without units. MAD carries the units of the data. Dropping the unit makes the number uninterpretable.

Treating MAD as a substitute for examining the data. A single number cannot describe a distribution. MAD summarizes one aspect of spread. Always look at the values themselves.

A Second Worked Example With Tighter Data

To see MAD behave when there are no outliers, take five values: 20, 21, 22, 23, 24.

Sorted: 20, 21, 22, 23, 24

Median = 22 (the 3rd of 5 values)

Absolute deviations:

ValueDeviation from 22Absolute deviation
20-22
21-11
2200
23+11
24+22

Sorted absolute deviations: 0, 1, 1, 2, 2

Median of 5 values = 1

MAD = 1

Scaled MAD = 1.4826 × 1 = 1.4826

Now compare with the standard deviation. The mean is 22, and the squared deviations are 4, 1, 0, 1, 4, summing to 10. The sample variance is 10 / 4 = 2.5, so the sample SD is about 1.58. The scaled MAD, 1.48, sits close to the SD, which is what you expect when the data are clean and roughly symmetric. On tidy data, MAD and SD agree. On messy data, they diverge, and MAD is the one that keeps its footing.

Frequently Asked Questions

What is the median absolute deviation in simple terms?

MAD is the typical distance between a data value and the median of the dataset. You find the median, measure how far each value sits from it, and take the median of those distances.

How do you find MAD step by step?

Sort the data, find the median, subtract the median from every value, take absolute values, sort those absolute deviations, and take their median. That final median is MAD.

What is absolute deviation?

Absolute deviation is the positive distance between one value and a reference point, such as the mean or median. Signs are removed so deviations never cancel out.

How is MAD different from mean absolute deviation?

MAD anchors on the median and averages with a median. Mean absolute deviation anchors on the mean and averages with an arithmetic mean. MAD resists outliers, mean absolute deviation does not.

Why multiply MAD by 1.4826?

The constant rescales MAD so it estimates the standard deviation consistently when the data are normally distributed. It is unitless and does not change the units of the result.

What units does MAD have?

MAD carries the same units as the original data, because it is built from subtraction and ordering, both of which preserve units.

When should I use MAD instead of standard deviation?

Use MAD when the data contain outliers, when the distribution is skewed, or when you are screening data for quality. Use standard deviation when the data are clean and roughly symmetric.

Can MAD be zero?

Yes. If more than half the values equal the median, the median of the absolute deviations is zero. This happens with data that cluster tightly on a single repeated value.

Related Articles

Sources

  1. Robust and non-parametric statistics in the evaluation of figures of merit of analytical methods. Practices for students.
  2. MAD saccade: statistically robust saccade threshold estimation via the median absolute deviation.
  3. Robust ΔΔct estimate.
  4. A Novel Approach to Speed Up Hampel Filter for Outlier Detection.
  5. Input data quality control for NDNQI national comparative statistics and quarterly reports: a contrast of three robust scale estimators for multiple outlier detection.
  6. Statistically robust detection of spontaneous, non-stereotypical neural signals.
  7. A robust cusum control chart for median absolute deviation based on trimming and winsorization.
  8. Assessment of average of normals (AON) procedure for outlier-free datasets including qualitative values below limit of detection (LoD): an application within tumor markers such as CA 15-3, CA 125, and CA 19-9.
  9. Uncertainty in collocated mobile measurements of air quality.
  10. SpatialArtifacts: a computational framework for tissue artifact detection in spatial transcriptomics data.
  11. Robust automated three-dimensional speed-of-sound compensation for hemispherical photoacoustic computed tomography.
  12. Robust proportional overlapping analysis for feature selection in binary classification within functional genomic experiments.
  13. Robust statistical methods for hit selection in RNA interference high-throughput screening experiments.
  14. Robust process capability indices C(pm) and C(pmk) using Weibull process.