The Problem
The median absolute deviation (MAD) is another measure of variability. As it uses the median, it tends to be more resistent to outliers than measures of spread using the mean (like the variance). To illustrate calculating the median absolute deviation, assume that you collected the following 8 data values:
100, 6, 85, 82, 83, 31, 25, 27
Calculate the median absolute deviation of this sample.
Your Answer
You got the correct answer of 42.9948. Congratulations!
Unfortunately, your answer was not correct. Either try again or click on “Show Solution” below to see how to obtain the correct answer.
Assistance
Hide Solution
The sample median absolute deviation is the median absolute deviation from the sample median.
 Calculate the sample median of the data
 Calculate the difference between each data value and the sample median
 Take the absolute value of those differences
 Calculate the median of those absolute values
 Finally, divide that median by 0.6745
The table below shows the schema:
Datum  Median  Deviation  Absolute Deviation 
100 
56.5 
43.5  43.5 
6 
56.5 
50.5  50.5 
85 
56.5 
28.5  28.5 
82 
56.5 
25.5  25.5 
83 
56.5 
26.5  26.5 
31 
56.5 
25.5  25.5 
25 
56.5 
31.5  31.5 
27 
56.5 
29.5  29.5 
The table shows steps 2 and 3. Step 4 is to calculate the median of the final column: 29. The final step is to divide this median by 0.6745. Doing so gives the sample median absolute deviation as MAD = 42.9948.
Hide the R Code
Copy and paste the following code into your R script window, then run it from there.
sample = c(100, 6, 85, 82, 83, 31, 25, 27)
mad(sample)
In the R output, the sample median absolute deviation is the number output by the script.
Hide the Excel Code
Copy and paste the following code into your Excel spreadsheet window, making sure your cursor is in A1
when you paste.
Copy and paste the following code into your Excel spreadsheet window, making sure the value sample1
ends up in A1
after pasting.
How to calculate the expected value in Excel.
sample  median  deviation  absolute deviation    
100 
=MEDIAN(A:A) 
=A2B2 
=ABS(C2) 

MAD: 
=MEDIAN(D:D)/0.6745 
6 
=MEDIAN(A:A) 
=A3B3 
=ABS(C3) 



85 
=MEDIAN(A:A) 
=A4B4 
=ABS(C4) 



82 
=MEDIAN(A:A) 
=A5B5 
=ABS(C5) 



83 
=MEDIAN(A:A) 
=A6B6 
=ABS(C6) 



31 
=MEDIAN(A:A) 
=A7B7 
=ABS(C7) 



25 
=MEDIAN(A:A) 
=A8B8 
=ABS(C8) 



27 
=MEDIAN(A:A) 
=A9B9 
=ABS(C9) 



Note that there is no MAD
function in Excel. The only way to calculate the median absolute deviation is to perform the calculations described in the formula.