The full blog post is still accessed through here. We are in the process of moving it to the current location.
Why use the geometric mean? Why harmonic?
July 21, 2018
How often do you think about averages? In my case, there isn't a day that goes by in which I don't think about some sort of "average". However, when I do so, I seldom have a specific mathematical concept in mind. Instead I think about the average representing a "typical value".
For example, when I shop for
One can either postulate about such typical values, or obtain them from data. When considering data, the most common the most common is the arithmetic mean. To caluculate it given, a collection of numbers, , we have,
For example try to think about how many times you smile per day. Say that over a period of three days, we record the following number of smiles per day
In this case, summing up the values and dividing by , the average number of daily smiles is .
However, there are other ways of describing typical values, often referred to measures of centrallity. For example as discussed here we can also use the median. Then there are also weighted averages and a variety of other varients such as the truncated (trimmed) mean. Another related term is mathematical expecation dealing with an average of a probability distribution as opposed to the average of data.
Other alternatives to the arithmetic mean include the geometric mean and harmonic mean. Some students, study these for the case of two data points, and as part of their high school studies. Then, some data scientistis understand why they are usefull in their applied work.
So why are there so many alternatives to describe the "typical value"? Which alterantive should we use?
Let's not focus on all the possible common measures of centrallity. Instead, let's consider two less popular friends of the arithmetic mean. These are the geometric mean and harmonic mean. You might have heard about these two alternative types of means before. But do you what are they good for?
To motivate the situation consider three scenarios where we make use of an average value, :
(i) Total calculations: Say you are about to carry items and wish to estimate the total weight you will carry. In this case, if is the average item weight, then clearly,
(ii) Return on investment calculations: Say you invest dollars in a variable return account for years. If the average growth rate per year is at a rate of then after years you have:
This is because during the first year, your dollar grows to be and after two years it is , etc...
(iii) Distance-time-speed calculations: Say you are travelling for a distance of kilometers at an average speed of kilometer/hour. In this case, the time travelled is:
In each of the cases (i)--(iii), the average value signifies a typical quantity. That is a typical weight in case (i), a typical growth factor in case (ii) and a typical speed in case (iii). Indeed, if all we are presented with is the value , then we would probably use the above formulas without trouble.
However, what if we are actually given data matching each of these scenarios? How would we compute the average matching the data? For example, what if and we were given,
The meaning of would vary depending on the context. For case (i) these values represent 4 individual weights, say in kilograms. For case (ii) these values represent growth factors for each of the 4 periods. For example the value represents growth by and the value represents decay by . Then for case (iii) let's assume that these values represent the speeds taken over consecuative miles. That is represents a speed of km/h during the first kilometer of motion, etc... these are quite slow speeds... but perhaps signify the speeds you would use when walking over tight rope (this is still a bit unrealistic because the world's longest tightrope walk record is for 547 meters).
Now with such a meaning for these values, how would we compute the average, ? It turns out, that each case has an ideally suited average. These are the arithmetic mean, the geometric mean and the harmonic mean.
Without further delay, lets compute these three means:
Arithmetic mean - this is simply the sum of the values divided by the total number of values:
Geometric mean - this is a product of the values and then taking the 'th root of it. For example if there were only two values, you would multiply them and take their square root. In our case, :
Harmonic mean - This is the inverse of the arithmetic mean of the inverse of the values. That is, instead of a value consider , sum up these values and divide by that sum. For we have:
You can observe that the average values that we get are not exactly the same. Infact,
and this inequality can be shown to hold for any data values, . Still, as you probably use the arithmetic mean all the time, why do we need geometric mean and harmonic mean?
To see the strength of each of these means, let's return to the cases (i), (ii) and (iii) above. Remember that an average is supposed to serve as a "typical value". Ideally, it can replace the actual data values.
So let's see. Consider formula (i) and replace by :
That seems to work well! As desired, the total weight is exactly reproduced.
Now consider formula (ii). What type of mean should we use in place of ? As you can guess, does the job:
You see, by using the geometric mean, , the exact return rate is retrieved.
As you might expect now, the harmonic mean works perfectly for case (iii). Use in place of to obtain:
This is also the desired quantity. Since on each kilometer we had a different speed and the time for kilometer was .
So you see, there are different ways to average depending on the context. In practice, the arithmetic mean is the most common way, however for specific contexts involving growth rates, the geometric mean works better and for contexts involving rates the harmonic mean does the job.
Have you ever used the geometric or harmonic mean? Let us know.