Median

Kapitoly: Average, Median, Modus, How to calculate grade point average, Geometric mean, Harmonic mean

In simple terms, the median divides some set of values so that half of the values are less than the median and the other half of the values are greater than the median. In reality, it's a little more complicated than that, and we'll look at that now.

What is the median

With the median, it plays a role whether the number of elements of the population is even or odd. In the case where the number of elements of the population is odd, we get the median by ordering all the values from smallest to largest, and the value that is exactly in the middle will be the median.

For an example, take the set of numbers 75, 4, 2, 3, 2, 5, 1. There are 7 in total, which is an odd number. We sort the numbers to get the sequence 1, 2, 2, 3, 4, 5, 75. The median, which we label $\mbox{Me}$, will be the element that is in the middle, which is the number 3. Thus, a general formula for a population X of size |X| = N, whose elements are xi and are ordered from smallest to largest, would be:

$$ \mbox{Me}(X) = x_{(N+1)/2} $$

If we tried this for our set of values X = [1, 2, 2, 3, 4, 5, 75], we would get:

$$ \mbox{Me}(X) = x_{(N+1)/2} = x_{(7+1)/2} = x_{8/2}=x_4=3 $$

For an even number of elements, we have to make a small adjustment, because an even sequence of values does not have an "element in the middle". If we remove one two from our population, we get the population: Y = [1, 2, 3, 4, 5, 75] and it has no middle element. Both numbers 3 and 4 are "equally in the middle". In this case, the way to solve this is to take the two elements that are thus in the middle and take the median as their arithmetic mean. Thus the median of the values of Y would be the value of (3 + 4)/2 = 3,5.

The general formula for X values of N with the elements xi lined up would look like this:

$$ \mbox{Me}(X) = \frac{x_{N/2} + x_{(N/2)+1}}{2} $$

If we calculate the median of the values of Y = [1, 2, 3, 4, 5, 75], where we label the elements yi, in this way, we get:

$$ \mbox{Me}(Y) = \frac{y_{N/2} + y_{(N/2)+1}}{2} = \frac{y_{6/2} + y_{(6/2)+1}}{2} = \frac{y_3 + y_4}{2} = \frac{3+4}{2}=3{,}5 $$

Benefits of the median

The median, unlike the mean, does not suffer from problems if there are any extremes in the set of values. In the example above with the set X = [1, 2, 2, 3, 4, 5, 75], we would get the mean $92 / 7 \approx 13,1428$, which is a bit of an odd value since six of the seven elements are much smaller. The median is then a reasonable number, three.

The median can further be used for all values that can be sorted somehow. We can only take the average for values that we can add and then divide. For example, take a clothing size: there is usually some sequence like XS, S, M, L, XL, XXL. It would be hard to make an average of such values, because it is not clear how to add XS + L or XL + L, and it is not clear how we would divide it in the end. However, if some population has bought clothes S, S, M, L, L, XXL, we can say that the median is size L. The problem can arise when we have an even number of sizes, because then we can't do an arithmetic average. In this case, we usually just choose one of the two middle numbers as the median.