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 4 data values:
30, 41, 37, 92
Calculate the median absolute deviation of this sample.
Your Answer
You got the correct answer of 8.1542. 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 
30 
39 
9  9 
41 
39 
2  2 
37 
39 
2  2 
92 
39 
53  53 
The table shows steps 2 and 3. Step 4 is to calculate the median of the final column: 5.5. The final step is to divide this median by 0.6745. Doing so gives the sample median absolute deviation as MAD = 8.1542.
Hide the R Code
Copy and paste the following code into your R script window, then run it from there.
sample = c(30, 41, 37, 92)
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    
30 
=MEDIAN(A:A) 
=A2B2 
=ABS(C2) 

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



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



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



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.