## Tuesday, January 10, 2012

### Extracting the Correct Mean(ing) From the Data

We've all taken, and/or taught, an introductory course in descriptive statistics where we encounter measures of "central tendency", variability, summarizing grouped data, and so on. In such courses students are usually told about three ways of calculating the mean, or average, of a sample. These are the Arithmetic Mean, Geometric Mean, and Harmonic Mean. In my experience, economists often fail to use the most appropriate of these three measures. I think this is because often we don't provide enough motivation and explanation in those introductory courses.

Let's begin by recalling how these three averages are computed:
• Arithmetic mean: AM = (1/n) Σi (xi)
• Geometric mean: GM = [Πi (xi)]1/n
• Harmonic mean: HM = [(1/n) Σi (1/xi)]-1

They're obviously related to one another - in fact they're the three so-called "Pythagorean means", as studied originally by Pythagoras and his followers. Pythagoras developed them from geometric principles, and chose them because they each exhibit four (desirable) properties. Letting "M" denote any one of the three means above, these properties are:
1. Value preservation:  M[x, x, x, ....x] = x.
2. First-order homogeneity:  M[bx1, bx2, ...., bxn] = b M[x1, x2, ...., xn].
3. Exchange invariance:  M[....., xi, ..., xj, .....] = M[...., xj, ...,xi,...]; for all i and j.
4. Averaging:  Min{x1, x2, ...., xn}  ≤  M[x1, x2, ...., xn]  ≤  Max.{x1, x2, ...., xn}.

We can see immediately that the Harmonic Mean is just the reciprocal of the Arithmetic Mean of the reciprocals of the data. (What a mouth-full!) We can also see that the logarithm of the Geometric Mean is the Arithmetic Mean of the logarithms of the data.

Applying these three formulae to the sample of data  ${1, 4, 7, 10}, for example, we get the results: AM =$5.5 ; GM = $4.091 ; and HM =$2.679 .

Notice that these averages are ranked HM <  GM  <  AM, and this is no accident. If the data are non-negative then this ranking must always hold, as is discussed towards the end this post; and the three measures will be equal if and only if every item in the sample takes the same value (They'll all equal this single value, of course, by the Value Preservation property above.) For this particular sample, the Harmonic Mean takes a value that really doesn't seem to be "representative" - at least not in the way that the geometric or arithmetic means are - and here, the latter happens to equal the sample median.

One thing to notice about these three different averages is that they differ in their robustness to "outliers" in the data. Just as we might think of using the sample median (rather than a sample mean) to reduce sensitivity to extreme values in the sample, so too we might think carefully of our choice between AM, GM, and HM.

To see this, suppose that we change the sample above so that now it is ${1, 4, 7, 100}. The sample median is unchanged at$5.5 [ = (4 + 7) / 2], but now we have AM = $28 ; GM =$7.274; and HM = $2.851. In this particular case, the Geometric Mean is more robust to the outlier than is the Arithmetic Mean. The Harmonic Mean is particularly robust (and its value changes only to$2.870 if the last sample value is increased to $1000), but hence still not visibly "representative". The two samples considered so far involve observations which have simple units of measurement - namely, dollars. In order to get further insight into the appropriate way of constructing a sample average, it's instructive to "look behind the numbers", and ask what they are actually measuring. Let's suppose that in our sample${1, 4, 7, 10} the values are the price of the same item in four different locations. The numbers represent levels, and (putting outlier issues to one side) the AM is quite appropriate.

Suppose, however, that we had these four prices together with the prices for a different good, at the same four locations: ${2, 12, 14, 24}. Now consider the relative price of good 2 to good 1, at the four locations. These are {2, 3, 2, 2.4}, and note that these ratios are unit-less. What's the average of these relative prices? We can easily see that AM = (9.4 / 4) = 2.35. But is this the most appropriate measure in this case? One way to think about this question is as follows. In the original (or second) sample none of the values would change if we added an amount of zero dollars to them. We could view zero as being a benchmark value. However, when we look at relative prices, things are rather different. A ratio of unity is now the more appropriate benchmark, and note that multiplying numbers by unity also leaves them unchanged. So, when the data are measuring ratios, it`s generally accepted that the Geometric Mean is more appropriate than the Arithmetic Mean. In our example, the answer is GM = 2.317 (c.f. AM = 2.35). There's another really important situation that arises with economic / financial data where the GM is the appropriate way to average the data. Consider an investment of$100 which yields returns of 5% p.a., 10% p.a., and 15% p.a. in three successive years. The Arithmetic Mean of these three values is 10% p.a., but as we'll see, this is not the appropriate way to calculate the average in this case.

Compounding the returns, we find that our $100 is worth$105 after one year; $115.5 at the end of the second year; and$132.825 at the end of the three years. Notice that if we compounded the investment using the average return AM = 10%, the implied value at the end of three years would  be $133.1 [=$100 (1.1)3]. This overstates the correct answer of $132.825. On the other hand, consider computing the Geometric Mean of the growth "multipliers": GM = (1.05*1.1*1.15)1/3 = 1.099242 . Then, the value of our investment, compounded over three years using this average is$100*(1.099242)3 = $132.825. This is the correct answer! Further economic examples of where the Geometric Mean arises are with the United Nations "Human Development Index", which has been constructed on the basis of Geometric (rather than Arithmetic) Means since 2010; and with necessary conditions for stochastic dominance (Jean, 1980). The Harmonic Mean is encountered less frequently then the other two averages when describing economic data, but there are some important instances where it arises or should be used. In particular, the Harmonic Mean is the appropriate average to use when dealing with data that are "rates". The classic example is fuel economy (miles per gallon, or liters per 100 Km), but economic examples also abound. For instance, consider data on "hours worked per week" (a rate). Suppose that we have four people (sample observations), each of whom work a total of 2,000 hours. However, they work for different numbers of hours per week, as follows: Person Total Hours Hours per Weeks Week Taken 1 2,000 40 50 2 2,000 45 44.4444 3 2,000 35 57.142857 4 2,000 50 40 Total: 8,000 191.587297 The Arithmetic Mean of the values in the third column is AM = 42.5 hours per week. However, notice what this value implies. Dividing the total number of weeks worked by the sample members (8,000) by this average value yields a value of 188.2353 as the total number of weeks worked by all four people. Now look at the last column in the table above. In fact the correct value for the total number of weeks worked by sample members is 191.5873 weeks. If we compute the Harmonic Mean for the values for Hours per Week in the third column of the table we get HM = 41.75642 hours (< AM), and dividing this number into the 8,000 hours gives us the correct result of 191.5873 for the total number of weeks worked. Here is a case where the Harmonic Mean provides the appropriate measure for the sample average. The Harmonic Mean also arises in the stochastic dominance literature (e.g., Jean, 1984). For simplicity, the discussion so far has been restricted to "simple", or "unweighted" mean values. Just as we're familiar with the concept of a "weighted" Arithmetic Mean, we can also construct weighted Geometric or Harmonic Means, so as to give different emphasis to different items in the sample. Letting wi denote the weight for ith sample value, we have: • AMw = [Σi (wixi)] / [Σi (wi)] • GMw = [Πi (xiwi)]1/Σi (wi) • HMw = [Σi (wi)] / [Σi (wi / xi)] (Obviously, if all of the weights are equal, then we just get the simple AM, GM, and HM formulae.) Additional economic examples of the occurrence of the Geometric and Harmonic Mean arise, in these "weighted" forms, in the construction of index numbers (such as price indices). Let pit and qit be the price and quantity of the ith good in period "t", and let period "0" be the base period for the index. Then, one sensible price index can be constructed as a Geometric Mean of "price-relatives", with base-period expenditures as the weights. The value of the index in period "t" would be: PGt = [Πi (pit / pi0)pi0qi0 ]1/Σi ((pi0 qi0. You'll also recall that Fisher's "ideal" price index is computed by taking the Geometric Mean of Laspeyres' price index, and Paasche's price index. When we consider the Laspeyres' price index itself, it can be considered either as an weighted aggregative index, with base-period quantities as the weights, or (equivalently) as an arithmetic weighted average of "price-relatives", with base-period expenditures as the weights. Similarly, Paasche's price index is not only a weighted aggregative index, with current-period quantities as the weights, but it also a weighted arithmetic average of price-relatives, with the "mixed" expenditures, (pi0qit) as the weights. These last two results tell us immediately that the Laspeyres' and Paasche's price indices are likely to exhibit some sort of "distortion" - as indeed, they do. Price-relatives are ratios, so Geometric means, rather than Arithmetic means should be used. Further, Paasche's price index can also be written in the form of an Harmonic Mean. The usual (aggregative) form of the index is: PPt = [Σi (pitqit)] / [Σi (pi0qit)], which can also be written as the Harmonic Mean of price-relatives, with current-period expenditures as the weights: PPt = {[Σi((pitqit)(pi0 / pit))] / [Σi(pitqit)]}-1 . Now, to round things up, let's return to the matter of the rankings of the values of each of three means, when applied to the same set of positive data. First, consider the ranking of the AM and GM, and for simplicity let's just take the case where there are only two different values, x1 and x2. (We know already that if x1 = x2, then AM = GM.) So, we have (x1 - x2) ≠ 0, which implies that (x1 - x2)2 > 0, or, x12 - 2x1x2 + x22 > 0. Adding 4x1x2 to both sides, we have x12 + 2x1x2 + x22 > 4x1x2 or, (x1 + x2)2 > 4x1x2 or, [(x1 + x2) / 2]2 > x1x2. Finally, this implies that [(x1 + x2) /2] > (x1x2)(1/2). That is, AM > GM. You'll find various proofs that AM > GM in the general case, here. Now, what about the ranking of the Harmonic and Geometric Means? In this case we can deal with the general case on n sample values, not all equal in value quite easily. We begin by using the result that we just established, namely that AM > GM, or [(x1 + x2 + .... + xn) / n] > (x1x2......xn)(1/n). Applying this result to the reciprocals of the data, we immediately have: [(1/x1) + (1/x2) + ... + (1/xn)] / n > [(1/x1)(1/x2)....(1/xn)](1/n), or, [1 / HM] > [(1)(1/n)] / [(x1x2....xn)(1/n)]. In other words, we have [1 / HM] > [ 1/ GM], implying that HM &lt; GM. So, what's the take-away message here? It's simple enough. While there are various ways of calculating the "average" of a sample of economic data, we need to think about the context and the form of the data before we leap in. Failure to do so could result in some very misleading results. Note: The links to the following references will be helpful only if your computer's IP address gives you access to the electronic versions of the publications in question. That's why a written References section is provided. References Jean, W. H., 1980. The geometric mean and stochastic dominance. Journal of Finance, XXXV, 157-151-158. Jean, W. H., 1984. The harmonic mean and other necessary conditions for stochastic dominance. Journal of Finance, XXXIX, 527-534. © 2012, David E. Giles #### 20 comments: 1. i never know what to expect on this blog. i only know that it will be fascinating and well worth my time to read! 2. Danny: Thanks for the kind comment - I hope I can hold your interest! 3. Thanks for this, David. I've seen (theoretical) models that use the HM rather than the AM, and wondered about the implications - other than that it greatly simplified some algebra - but never pursued it. This post is food for thought. 1. Thanks Linda! 4. I read a lot of blogs but i learn only from your blog. 5. Thanks for the kind comment - glad you find it helpful. 6. typo: x1^2 + 3x1x2 + x2^2 > 4x1x2 should be: x1^2 + 2x1x2 + x2^2 > 4x1x2 1. Anonymous: Thanks!!! (Fixed.) 7. Hi Dave Big fan of your blog, but could you elaborate this a little bit more please? What do you mean by adding zero dollars would not change the anounts and zero (and ratio of unity in the next paragraph) being the benchmark? "Suppose, however, that we had these four prices together with the prices for a different good, at the same four locations:${2, 12, 14, 24}. Now consider the relative price of good 2 to good 1, at the four locations. These are {2, 3, 2, 2.4}, and note that these ratios are unit-less. What's the average of these relative prices?

We can easily see that AM = (9.4 / 4) = 2.35. But is this the most appropriate measure in this case? One way to think about this question is as follows. In the original (or second) sample none of the values would change if we added an amount of zero dollars to them. We could view zero as being a benchmark value. However, when we look at relative prices, things are rather different. A ratio of unity is now the more appropriate benchmark, and note that multiplying numbers by unity also leaves them unchanged."

1. Thanks for the comment. I don't think I expressed myself very well in that passage! Waht I was getting at is that if we are adding up numbers (as in the AM), the answer will be unchanged if we add zero to any number. When we have (price) ratios, the ratio will be unchanged if the denominator price is unity. Multiplying (as opposed to adding) seems to be the more "natural" way of aggregating ratios. Hmmmm. (Still not sure!)

8. Hi Dave, thanks for this blog, I find it a great resource.

I hope you don't mind if I reference some of your blog posts in my undergraduate teaching?

Thanks

Barry Quinn (Queens University Belfast)

1. Barry - thanks for the comment. Please feel free to reference the material in any way that's helpful to you and your students.

9. Dave, can we say anything about how GM and HM would estimate E(X)?

1. I should have added....... remember that the expectation operator is a linear operator, so when we apply it to a linear combination of the sample data (the AM), the result is independent of the underlying population distributon. On the other hand, the GM and HM are non-linear functions of the sample data, so not too surprisingly, when we apply the expectation operator, things don't work out so well. Specifically, the result is dependent on the population distribution.

2. Thanks for the response Dave. I would imagine that the GM and HM would be biased in most situations, but was thinking that we at least say that they were consistent (regardless of the underlying distribution). Perhaps I'll have to search a bit more on this topic...

3. This comment has been removed by the author.

4. The GM and HM are not necessariy (weakly) consistent estimators of E[X]. I have some simulation results that provide a counter-example, and which I'll post this evening (7 February, 2012)

10. Hi: yes we can, but it depends on the population distribution.

Now, in the case of the arithmetic mean, if we have simple random sampling then (regardless of the population distribution) we have E(AM) = Mu (the true population mean; and var(AM) = sigma^2/n.

Once we move to the GM and the HM, these are biased estimators of Mu. And the nature of the bias depends on the precise form of the underlying population. This is therefore quite different from the situation of the AM.

One reference I can give you is E(GM) when the population is log-normal. See http://www.cba.ua.edu/assets/docs/efl/WP_133.pdf

I hope this helps a bit!

11. I often find it hard to figure out if something is a rate or a ratio. Returns on an investment are usually treated as a ratio when calculating means (as you did above), but they are also a rate since they are usually denominated in "x% per unit of time." Would "use HM when the data is levels per unit of time" be a better heuristic?

1. Dimitriy: Yes, that would be reasonable.