In statistics, there are mainly three types of measures of central tendency: mean, median and mode. Also, dispersion is an important concept in statistics which means to study the spread of the data. There are various measures of dispersion, median absolute deviation is one of the important topics.
Median is the value that lies in the center. Median standard deviation is defined as absolute value of deviation of each observation from the median of the data. It is the median of absolute deviation from median.
The value of median absolute deviation refers to the dispersion of data from its median.
In order to determine median absolute deviation, one needs to first calculate the median of data. Then, it is subtracted from each observation of the data and their absolute values are calculated.
On dividing the sum of these values by the total number of observations, we get the median absolute deviation of data.

The formula for median absolute deviation is given below:
Formula for median absolute deviation 

 $MAD$= $\frac{\sum^{n}_{i=1}(x_{i}-M)}{n}$
Where, 
$n$ = Total number of observations
$M$ = Median of the data
$x_{i}$ = An observation among the data
We can also write the simplified form of above formula as:

$MAD$ = $\frac{(x_{1}-M)+(x_{2}-M)+(x_{3}-M)+...+(x_{n}-M)}{n}$
Where,
$MAD$ stands for median absolute deviation.
and $x_{1}$, $x_{2}$, $x_{3}$, ..., $x_{n}$ are the individual observations of the given data.
Let us recall that the median of a data is calculated by either of the following given formulae:
Case 1: When total number of observations $(n)$ is odd.

$M$ = $(\frac{n+1}{2})^{th}\ term$

Case 2:  When total number of observations $(n)$ is even
.
$M$ = $\frac{(\frac{n}{2})^{th}\ term+(\frac{n}{2}+1)^{th}term}{2}$
We are supposed to follow the steps illustrated below in order to calculate the median absolute deviation of a data set.
Step 1:  Arrange all numbers of a data set in ascending order.

Step 2:  Find the total number of items given in the data and denote it by $n$.

Step 3: Check whether n is even or odd. Calculate the median of the data by using the appropriate formula.
If n is even, then use the formula: 

$M$ = $\frac{\frac{n}{2}^{th}\ term+(\frac{n}{2}+1)^{th}term}{2}$. 

If n is odd, then apply the formula:

$M$ = $(\frac{n+1}{2})^{th}\ term$,
in order to estimate median $M$.
Step 4: Construct a table for determining deviation of each number from median. In order to do so, in a column, subtract median value from each number ignoring negative sign. Sum up these absolute deviations.

Step 5: Divide the sum of these deviations by total number of observations. The result will be the required answer.
The examples related to median absolute deviation are given below:
Example 1:  Calculate the median standard deviation for the following data:
8, 2, 6, 4, 9, 8, 5, 9, 5
Solution: Given data in ascending order is:
2, 4, 5, 5, 6, 8, 8, 9, 9
Total number of observations, $n$ = 9 which is odd
Therefore, following formula for median would be used.

$M$ = $(\frac{n+1}{2})^{th}\ term$
$M$ = $(\frac{9+1}{2})^{th}\ term$

$M$ = $5^{th}$ term
i.e. 6
Let us construct the following table:
$x_{i}$
$x_{i}$ - M
|$x_{i}$ - M|
2
2 - 6 = - 4  4
4
4 - 6 = - 2
 2
5
5 - 6 = - 1  1
5
5 - 6 = - 1
 1
6
6 - 6 = 0
 0
8
8 - 6 = 2
 2
8
8 - 6 = 2
 2
9
9 - 6 = 3
 3
9
9 - 6 = 3
 3
$n$ = 9
  $\sum^{n}_{i=1}$|$x_{i}$ - M| = 18 
The formula for median absolute deviation is :

$MAD$ = $\frac{\sum^{n}_{i=1}(x_{i}-M)}{n}$
$MAD$ = $\frac{18}{9}$
= 2

Example 2:  Following are marks obtained by the 8 students in mathematics class test out of 20. Determine the median standard deviation.
17, 18, 15, 10, 6, 17, 12, 5
Solution:  Rearranging the above data in ascending order:
5, 6, 10, 12, 15, 17, 17, 18
Total number of observations, n = 8
which is an even number.
Therefore, applying following formula for calculating median:

$M$ = $\frac{(\frac{n}{2})^{th}\ term+(\frac{n}{2}+1)^{th}term}{2}$

$M$ = $\frac{(\frac{8}{2})^{th}\ term+(\frac{8}{2}+1)^{th}term}{2}$

$M$ = $\frac{4^{th}\ term+5^{th}term}{2}$

$M$ = $\frac{12+15}{2}$

$M$ = 13.5
Let us construct the following table:
$x_{i}$
$x_{i}$ - M
|$x_{i}$ - M|
5 - 13.5 = - 8.5 8.5
6
6 - 13.5 = - 7.5
7.5
10
10 - 13.5 = - 3.5
3.5
12
12 - 13.5 = - 1.5
1.5
15
15 - 13.5 = 1.5
1.5
17
17 - 13.5 = 3.5
3.5
17
17 - 13.5 = 3.5
3.5
18
18 - 13.5 = 4.5
4.5
$n$ = 8
  $\sum^{n}_{i=1}$|$x_{i}$ - M| = 34 
The formula for median absolute deviation is:

$MAD$ = $\frac{\sum^{n}_{i=1}(x_{i}-M)}{n}$
$MAD$ = $\frac{34}{8}$

= 4.25