# Mean Deviation

 Jakob Jenkov Last update: 2016-03-07

The term mean deviation is a measure that tells how much the observations in the data set deviates from the mean value of the observations in the data set.

## Deviation

To calculate the mean deviation you first have to calculate the deviation of each observation from the mean value of all observations in the data set. To do so, you must first calculate the mean value of all observations in the data set. To illustrate that I have created the following example data set:

```5, 2, 2, 3, 4, 5, 5, 6, 7, 8, 9, 10
```

The sum of all observations in this data set is 62. The data set contains 12 observations. The mean value of the observations of this data set calculated like this:

```mean = ratio(66, 12) = 5.5
```

Once we have calculated the mean value of the observations in the data set, we can calculate the deviation of each observaton from the mean value. For instance, the deviation of the value 5 (first observation in the data set) from the mean value 5.5 is -0.5 . Below I have calculated the deviations of each observation in the data set from the mean value:

```-0.5, -3.5, -3.5, -2.5, -1.5, -0.5, -0.5, 0.5, 1.5, 2.5, 3.5, 4,5
```

Obviously, if we sum all these values the result will be 0 because each deviation is calculated as the difference between the mean value of all observations and the value of the observation itself. Therefore it does not make sense to calculate the mean deviation based on deviation alone. The result would always be 0.

## Mean Absolute Deviation

Instead of calculating the mean deviation we can calculate the mean absolute deviation . Rather than using the exact deviations we use the absolute value of each deviation. Thus, all deviations become positive. Using the absolute deviation we get the following list of deviations:

```0.5, 3.5, 3.5, 2.5, 1.5, 0.5, 0.5, 0.5, 1.5, 2.5, 3.5, 4,5
```

The sum of the absolute deviations is 25. With 12 observations the mean absolute deviation is calculated as:

```meanAbsDeviation = ratio(25, 12) = 2.08333
```

The mean absolute deviation of the above data set is thus 2.08333 (25 divided by 12).

## Mean Positive Deviation and Mean Negative Deviation

Instead of just calculating the mean absolute deviation you can calculate the mean positive deviation and mean negative deviation. The mean positive deviation is the mean of all positive deviations. Similarly, the mean negative deviation is the mean of all negative deviations.

The following two lists of number contains the positive and negative deviations from the example data set above.

``` -0.5, -3.5, -3.5, -2.5, -1.5, -0.5, -0.5
```
``` 0.5, 1.5, 2.5, 3.5, 4,5
```

As you can see, there are 7 negative deviations and 5 positive deviations. The sum of the negative deviations is -12.5 . The sum of the positive deviations is 12,5. This is not surprising. The total sum of all deviations is 0. Therefore the sum of the negative and positive deviations will naturally cancel each other out.

Since there are 7 negative deviations the mean negative deviation is:

```meanNegDeviation = ratio(-12.5, 7) = -1.78571
```

There are only 5 positive deviations so the mean positive deviation is:

```meanPosDeviation = ratio(12.5, 5) = 2.5
```

Whether you want to use just the mean absolute deviation or split it up into mean positive deviations and mean negative deviations is up to you. You get more information from the mean positive and negative deviations than from the mean deviation itself. You can also calculate all three numbers. It really depends on what information you need from them.

 Tweet Jakob Jenkov
Close TOC All Trails Trail TOC Page TOC Previous Next