Algorithm Search⌘K

Definitionintro

Median absolute deviation

Also called MAD.

The median of the absolute deviations from the median. Scaled by 1.4826 it estimates the normal standard deviation with breakdown point 1/2.

The median absolute deviation (MAD) is a robust measure of spread. Take the median of the sample, then the median of the distances of the points from it. Half of the points are within one MAD of the median. Multiplied by 1/Φ−1(3/4)≈1.48261/\Phi^{-1}(3/4) \approx 1.4826, it estimates the standard deviation of a normal law. Unlike the standard deviation, it can carry almost half of the sample as outliers.

Definition

For a sample x1,…,xnx_1, \ldots, x_n, let med⁡\operatorname{med} be the sample median (the average of the two middle values when nn is even). The median absolute deviation is

MAD(x)=med⁡i ∣xi−med⁡jxj∣.\mathrm{MAD}(x) = \operatorname{med}_i\, |x_i - \operatorname{med}_j x_j|.

The normalized MAD is

σ^=MAD(x)Φ−1(3/4)≈1.4826 MAD(x),\hat\sigma = \frac{\mathrm{MAD}(x)}{\Phi^{-1}(3/4)} \approx 1.4826\,\mathrm{MAD}(x),

where Φ−1(3/4)=0.6744897…\Phi^{-1}(3/4) = 0.6744897\ldots is the upper quartile of the standard normal law.

For a law FF with median mm, the functional is the median of the law of ∣X−m∣|X - m|: the value qq with PF(∣X−m∣≤q)=1/2P_F(|X - m| \le q) = 1/2.

Computing the MAD needs two medians, so it takes linear time with a selection method such as quickselect.

Proof of the constant. Let X∼N(μ,σ2)X \sim N(\mu, \sigma^2). Its median is μ\mu. For c>0c > 0,

P(∣X−μ∣≤c)=Φ(c/σ)−Φ(−c/σ)=2Φ(c/σ)−1.P(|X - \mu| \le c) = \Phi(c/\sigma) - \Phi(-c/\sigma) = 2\Phi(c/\sigma) - 1.

This equals 1/21/2 if and only if Φ(c/σ)=3/4\Phi(c/\sigma) = 3/4, that is c=σ Φ−1(3/4)c = \sigma\,\Phi^{-1}(3/4). So the population MAD is σ Φ−1(3/4)\sigma\,\Phi^{-1}(3/4), and MAD/Φ−1(3/4)\mathrm{MAD}/\Phi^{-1}(3/4) has the functional value σ\sigma. The sample MAD tends to the population MAD almost surely when FF is continuous and the two medians are unique, so σ^\hat\sigma is consistent for σ\sigma at the normal. □\square

The constant is 1/0.6744897=1.482602…1/0.6744897 = 1.482602\ldots. At another law the same factor gives a different number. At the Laplace law with scale bb (standard deviation b2b\sqrt2), the MAD is bln⁡2b \ln 2.

Examples and non-examples

A small sample by hand. Take x=(2,4,4,5,7,9,30)x = (2, 4, 4, 5, 7, 9, 30). The median is 5. The absolute deviations are (3,1,1,0,2,4,25)(3, 1, 1, 0, 2, 4, 25); sorted, (0,1,1,2,3,4,25)(0, 1, 1, 2, 3, 4, 25). Their median is 2, so MAD=2\mathrm{MAD} = 2 and σ^=2×1.4826=2.9652\hat\sigma = 2 \times 1.4826 = 2.9652. The sample standard deviation is 9.656, mostly because of the point 30. Change 30 to 3000: the MAD stays 2, and the standard deviation becomes 1131.9.

An even sample. For (1,2,3,4,5,6)(1, 2, 3, 4, 5, 6) the median is 3.5, the deviations are (2.5,1.5,0.5,0.5,1.5,2.5)(2.5, 1.5, 0.5, 0.5, 1.5, 2.5), and the MAD is 1.5.

Breakdown point ⌊n/2⌋/n\lfloor n/2 \rfloor / n. Let the clean sample have distinct values, with n=2r+1n = 2r + 1 or n=2rn = 2r. Replace mm points. A scale estimate breaks down if it can go to infinity (explosion) or to zero (implosion); see breakdown point.

Proof. Explosion. If m<⌊(n+1)/2⌋m < \lfloor (n+1)/2 \rfloor, the median stays in [c−,c+][c_-, c_+], the range of the clean points (the breakdown point page proves this). Then every clean point has a deviation at most D=c+−c−D = c_+ - c_-. There are n−mn - m clean points. For odd nn, m≤rm \le r gives at least r+1r + 1 deviations at most DD, so the middle deviation is at most DD. For even nn, m≤r−1m \le r - 1 gives at least r+1r + 1 such deviations, so both middle deviations are at most DD. So no explosion happens with fewer than ⌊(n+1)/2⌋\lfloor (n+1)/2 \rfloor points.

Implosion. Let δ>0\delta > 0 be the least gap between two clean values. An open interval of length less than δ\delta holds at most one clean point. So at most m+1m + 1 deviations are less than δ/2\delta/2. If m≤⌊n/2⌋−1m \le \lfloor n/2 \rfloor - 1, then m+1≤rm + 1 \le r in both cases, so the (r+1)(r+1)-th smallest deviation is at least δ/2\delta/2, and the MAD is at least δ/4\delta/4. Conversely, put ⌊n/2⌋=r\lfloor n/2 \rfloor = r replaced points on top of one clean point x1x_1. Then r+1r + 1 points equal x1x_1. They are a majority of the sample, so the median is x1x_1, and r+1r + 1 deviations are 0. The (r+1)(r+1)-th smallest deviation is 0, and so is the MAD.

So implosion needs ⌊n/2⌋\lfloor n/2 \rfloor points and explosion needs ⌊(n+1)/2⌋\lfloor (n+1)/2 \rfloor, and εn∗=⌊n/2⌋/n\varepsilon^*_n = \lfloor n/2 \rfloor / n. This tends to 1/21/2, the best value for an equivariant scale estimator. □\square

Influence function and efficiency. Let FF be symmetric about mm with a density ff that is continuous and positive at m±qm \pm q, where qq is the population MAD. Contaminate with t δxt\,\delta_x. The median moves by O(t)O(t), but by symmetry its first-order effect on P(∣X−m∣≤q)P(|X - m| \le q) is f(m+q)−f(m−q)=0f(m+q) - f(m-q) = 0. Differentiate (1−t) [F(m+qt)−F(m−qt)]+t 1{∣x−m∣≤qt}=1/2(1-t)\,[F(m + q_t) - F(m - q_t)] + t\,\mathbf 1\{|x - m| \le q_t\} = 1/2 at t=0t = 0:

−12+2f(m+q) q′+1{∣x−m∣≤q}=0,IF(x;MAD,F)=sign⁡(∣x−m∣−q)4f(m+q).-\tfrac12 + 2f(m+q)\,q' + \mathbf 1\{|x - m| \le q\} = 0, \qquad \mathrm{IF}(x; \mathrm{MAD}, F) = \frac{\operatorname{sign}(|x - m| - q)}{4 f(m+q)}.

For σ^\hat\sigma at F=ΦF = \Phi, with q=Φ−1(3/4)=0.6745q = \Phi^{-1}(3/4) = 0.6745 and φ(q)=0.3178\varphi(q) = 0.3178, this is sign⁡(∣x∣−q)/(4qφ(q))\operatorname{sign}(|x| - q)/(4 q \varphi(q)). It takes only the two values ±1.1664\pm 1.1664. The asymptotic variance is E[IF2]=1/(4qφ(q))2=1.3605E[\mathrm{IF}^2] = 1/(4 q \varphi(q))^2 = 1.3605. The standard deviation has the influence function (x2−1)/2(x^2 - 1)/2 and the variance 1/21/2. So the efficiency of the MAD at the normal is 0.5/1.3605=0.36750.5/1.3605 = 0.3675, about 37 percent. Hall and Welsh (1985) proved the asymptotic normality.

Non-examples.

  • The mean absolute deviation 1n∑∣xi−xˉ∣\frac1n\sum|x_i - \bar x| is not robust. Its breakdown point is 1/n1/n, like the standard deviation.
  • A MAD that is zero. If more than half of the sample has one value, the MAD is 0, even if the other points are spread out. For example, (0,0,0,0,1,50)(0, 0, 0, 0, 1, 50) has MAD 0. Data that are rounded or counts often show this. Then a scale of 0 makes standardized residuals (xi−med⁡)/σ^(x_i - \operatorname{med})/\hat\sigma infinite.
  • The constant 1.4826 gives σ\sigma only at the normal law. It is not a general conversion from MAD to standard deviation.
  • Interquartile range. Q3−Q1Q_3 - Q_1, divided by 2Φ−1(3/4)=1.3492\Phi^{-1}(3/4) = 1.349 at the normal. Its breakdown point is 1/41/4. For a symmetric law the MAD is half the interquartile range.
  • SnS_n and QnQ_n of Rousseeuw and Croux (1993). Sn=c med⁡imed⁡j∣xi−xj∣S_n = c\,\operatorname{med}_i \operatorname{med}_j |x_i - x_j| and QnQ_n, the first quartile of the pairwise distances ∣xi−xj∣|x_i - x_j| for i<ji < j. Both have breakdown point 1/21/2 and need no location estimate. QnQ_n has an efficiency of about 82 percent at the normal.
  • Scale of an M-estimator. The Huber M-estimator and Tukey's biweight use the normalized MAD as a fixed scale, to make the location estimate scale equivariant.
  • Outlier rules. The rule ∣xi−med⁡∣/σ^>3|x_i - \operatorname{med}| / \hat\sigma > 3 (or 2.5) flags outliers. It is the robust form of the z-score rule, and statistical outlier removal for point clouds uses a related rule.

References

  1. Frank R. Hampel, The influence curve and its role in robust estimation, Journal of the American Statistical Association 69(346), 1974, pp. 383 to 393 (the median deviation as a robust scale estimator, and its influence function)
  2. Peter J. Rousseeuw and Christophe Croux, Alternatives to the median absolute deviation, Journal of the American Statistical Association 88(424), 1993, pp. 1273 to 1283 (the MAD, its breakdown point and its 37 percent efficiency, and the estimators Sn and Qn)
  3. Peter Hall and A. H. Welsh, Limit theorems for the median deviation, Annals of the Institute of Statistical Mathematics 37, 1985, pp. 27 to 36 (the asymptotic normality of the MAD)
  4. Ricardo A. Maronna, R. Douglas Martin, Victor J. Yohai and Matías Salibián-Barrera, Robust Statistics, Theory and Methods (with R), second edition, Wiley, 2019, Chapter 2 (dispersion estimators, the normalized MAD)
  5. Peter J. Huber and Elvezio M. Ronchetti, Robust Statistics, second edition, Wiley, 2009, Chapter 5 (scale estimates, the median absolute deviation)

Where this leads

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/KS6NA3/text.yaml