MedianDeviation
✖
MedianDeviation

gives the median absolute deviation from the median of the elements in data.
Details


- MedianDeviation is also known as MAD.
- MedianDeviation is a robust measure of dispersion, which means it is not very sensitive to outliers.
- For VectorQ data, {x1,x2,…,xn}, the median deviation
is given by the median of the vector {x1–
,…,xn–
}, where
is the median of data.
- For MatrixQ data, the median deviation is computed for each column vector with MedianDeviation[{{x1,y1,…},{x2,y2,…},…}] equivalent to {MedianDeviation[{x1,x2,…}],MedianDeviation[{y1,y2,…}],…}. »
- For ArrayQ data, the median deviation is equivalent to ArrayReduce[MedianDeviation,data,1]. »
- MedianDeviation handles both numerical and symbolic data.
- The data can have the following additional forms and interpretations:
-
Association the values (the keys are ignored) » SparseArray as an array, equivalent to Normal[data] » QuantityArray quantities as an array » WeightedData based on the underlying EmpiricalDistribution » EventData based on the underlying SurvivalDistribution » TimeSeries, TemporalData, … vector or array of values (the time stamps ignored) » Image,Image3D RGB channel's values or grayscale intensity value » Audio amplitude values of all channels » DateObject, TimeObject list of dates or list of times »



Examples
open allclose allBasic Examples (3)Summary of the most common use cases
MedianDeviation of a list:

https://wolfram.com/xid/0purq6q8q6-wd9

MedianDeviation of columns of a matrix:

https://wolfram.com/xid/0purq6q8q6-vu6sr

MedianDeviation of a list of dates:

https://wolfram.com/xid/0purq6q8q6-t7ech

Scope (18)Survey of the scope of standard use cases
Basic Uses (6)
Exact input yields exact output:

https://wolfram.com/xid/0purq6q8q6-ug7y2


https://wolfram.com/xid/0purq6q8q6-bcry2t

Approximate input yields approximate output:

https://wolfram.com/xid/0purq6q8q6-ksx55


https://wolfram.com/xid/0purq6q8q6-d02ofx

Find the median deviation of WeightedData:

https://wolfram.com/xid/0purq6q8q6-f1vfw

https://wolfram.com/xid/0purq6q8q6-qyv0h

Find the median deviation of EventData:

https://wolfram.com/xid/0purq6q8q6-e67u14

https://wolfram.com/xid/0purq6q8q6-or2nrz

Find the median deviation of TimeSeries:

https://wolfram.com/xid/0purq6q8q6-tolh7

The median deviation depends only on the values:

https://wolfram.com/xid/0purq6q8q6-hfeo7e

Find the median deviation of data involving quantities:

https://wolfram.com/xid/0purq6q8q6-jopin9


https://wolfram.com/xid/0purq6q8q6-e8c21s

Array Data (5)
MedianDeviation for a matrix works columnwise:

https://wolfram.com/xid/0purq6q8q6-ezu2uz

MedianDeviation for a tensor gives the columnwise median deviation at the first level:

https://wolfram.com/xid/0purq6q8q6-lw96ov


https://wolfram.com/xid/0purq6q8q6-nknun


https://wolfram.com/xid/0purq6q8q6-ma3v2m

When the input is an Association, median deviation works on its values:

https://wolfram.com/xid/0purq6q8q6-cs7n5q


https://wolfram.com/xid/0purq6q8q6-rvy4yi

SparseArray data can be used just like dense arrays:

https://wolfram.com/xid/0purq6q8q6-n691tv


https://wolfram.com/xid/0purq6q8q6-drrysl


https://wolfram.com/xid/0purq6q8q6-l4ct3


https://wolfram.com/xid/0purq6q8q6-d6csj0

Find the median deviation of a QuantityArray:

https://wolfram.com/xid/0purq6q8q6-lgwnaj


https://wolfram.com/xid/0purq6q8q6-k03qc6

Image and Audio Data (2)
Channelwise median deviation value of an RGB image:

https://wolfram.com/xid/0purq6q8q6-hfby9q


https://wolfram.com/xid/0purq6q8q6-phlz4o

Median deviation value of a grayscale image:

https://wolfram.com/xid/0purq6q8q6-ue2gq5

On audio objects, MedianDeviation works channelwise:

https://wolfram.com/xid/0purq6q8q6-nq1jnz


https://wolfram.com/xid/0purq6q8q6-mjmudf


https://wolfram.com/xid/0purq6q8q6-bs38vd

Date and Time (5)
Compute median deviation of dates:

https://wolfram.com/xid/0purq6q8q6-b1smxx

https://wolfram.com/xid/0purq6q8q6-pa4nmn


https://wolfram.com/xid/0purq6q8q6-uok1il

Compute the weighted median deviation of dates:

https://wolfram.com/xid/0purq6q8q6-c98kbd


https://wolfram.com/xid/0purq6q8q6-8c1had

https://wolfram.com/xid/0purq6q8q6-8y1qb7

https://wolfram.com/xid/0purq6q8q6-mun51z


https://wolfram.com/xid/0purq6q8q6-t71b2h

Compute the median deviation of dates given in different calendars:

https://wolfram.com/xid/0purq6q8q6-wbzcuv


https://wolfram.com/xid/0purq6q8q6-9ius88


https://wolfram.com/xid/0purq6q8q6-qe5gbw

Compute the median deviation of times:

https://wolfram.com/xid/0purq6q8q6-et9bla


https://wolfram.com/xid/0purq6q8q6-ztsexm

Compute the median deviation of times with different time zone specifications:

https://wolfram.com/xid/0purq6q8q6-mrqghz


https://wolfram.com/xid/0purq6q8q6-1d7sk5

Applications (4)Sample problems that can be solved with this function
Obtain a robust estimate of dispersion when extreme values are present:

https://wolfram.com/xid/0purq6q8q6-b99oaf

Measures based on the Mean are heavily influenced by extreme values:

https://wolfram.com/xid/0purq6q8q6-3fz1a


https://wolfram.com/xid/0purq6q8q6-ppqioq

Identify periods of high volatility in stock data using a five-year moving median deviation:

https://wolfram.com/xid/0purq6q8q6-nj16d1

https://wolfram.com/xid/0purq6q8q6-kfgcti

https://wolfram.com/xid/0purq6q8q6-bef0x

Compute median deviations for slices of a collection of paths of a random process:

https://wolfram.com/xid/0purq6q8q6-8se1zg

https://wolfram.com/xid/0purq6q8q6-52xxug

https://wolfram.com/xid/0purq6q8q6-iakfqb
Plot median deviations over these paths:

https://wolfram.com/xid/0purq6q8q6-tvmkqe

Find the median deviation of the heights for the children in a class:

https://wolfram.com/xid/0purq6q8q6-cevfij

https://wolfram.com/xid/0purq6q8q6-fllmtw


https://wolfram.com/xid/0purq6q8q6-celepo

Plot the median deviation respective of the median:

https://wolfram.com/xid/0purq6q8q6-g98mgx

Properties & Relations (2)Properties of the function, and connections to other functions
MedianDeviation is the Median of absolute deviations from the Median:

https://wolfram.com/xid/0purq6q8q6-793v1

https://wolfram.com/xid/0purq6q8q6-b9x4up


https://wolfram.com/xid/0purq6q8q6-bhsxlb

For large uniform datasets, MedianDeviation and MeanDeviation are nearly the same:

https://wolfram.com/xid/0purq6q8q6-dso2q7

https://wolfram.com/xid/0purq6q8q6-hfsstq


https://wolfram.com/xid/0purq6q8q6-vy95m

Possible Issues (1)Common pitfalls and unexpected behavior
MedianDeviation requires real numeric values:

https://wolfram.com/xid/0purq6q8q6-g88


Neat Examples (1)Surprising or curious use cases
Ratio of MedianDeviation to MeanDeviation for increasing sample size:

https://wolfram.com/xid/0purq6q8q6-ph16p

https://wolfram.com/xid/0purq6q8q6-jq0tcn

Wolfram Research (2007), MedianDeviation, Wolfram Language function, https://reference.wolfram.com/language/ref/MedianDeviation.html (updated 2024).
Text
Wolfram Research (2007), MedianDeviation, Wolfram Language function, https://reference.wolfram.com/language/ref/MedianDeviation.html (updated 2024).
Wolfram Research (2007), MedianDeviation, Wolfram Language function, https://reference.wolfram.com/language/ref/MedianDeviation.html (updated 2024).
CMS
Wolfram Language. 2007. "MedianDeviation." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2024. https://reference.wolfram.com/language/ref/MedianDeviation.html.
Wolfram Language. 2007. "MedianDeviation." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2024. https://reference.wolfram.com/language/ref/MedianDeviation.html.
APA
Wolfram Language. (2007). MedianDeviation. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/MedianDeviation.html
Wolfram Language. (2007). MedianDeviation. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/MedianDeviation.html
BibTeX
@misc{reference.wolfram_2025_mediandeviation, author="Wolfram Research", title="{MedianDeviation}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/MedianDeviation.html}", note=[Accessed: 25-March-2025
]}
BibLaTeX
@online{reference.wolfram_2025_mediandeviation, organization={Wolfram Research}, title={MedianDeviation}, year={2024}, url={https://reference.wolfram.com/language/ref/MedianDeviation.html}, note=[Accessed: 25-March-2025
]}