Why is the inverse of an average of numbers not the same as the average of the inverse of those same numbers?

7.4k Views Asked by At

I have a set of numbers (in my case: mean retention time (MRT) in the stomach (h)) of which I want to calculate the average gastric passage rate (/h). Gastric passage rate = 1/MRT.

My question is why 'the average of the calculated gastric passage rates of those numbers' is not the same as 'the calculated gastric passage rate of the averaged MRTs'. The next question is: what is the right way?

So for example:

$x = 5; 10; 4; 2.$ Average $= 5.25 h \Rightarrow 1/5.25 = 0.19$/h

$1/x = 0.2; 0.1; 0.25; 0.5.$ Average $= 0.26$/h

So should I first take the average of the MRTs and then take the inverse for calculating the gastric passage rate (first way) or should I first take the inverse of all numbers for calculating the gastric passage rates and then take the average of that number (second way).

Thanks in advance!

11

There are 11 best solutions below

6
On

Given some positive values $x_1$, ..., $x_n$, their average is $$\frac{x_1+\cdots+x_n}{n}=\frac{1}{n}\sum_{i=1}^nx_i,$$ and its inverse is $$\frac{1}{\frac{1}{n}\sum_{i=1}^nx_i}=\frac{n}{\sum_{i=1}^nx_i}.\tag{1}$$ On the other hand, the average of the inverses is $$\frac{\frac{1}{x_1}+\cdots+\frac{1}{x_n}}{n}=\frac{1}{n}\sum_{i=1}^n\frac{1}{x_i}\tag{2}.$$ In general, these two expressions are not the same, as your calculations also show.


I wrote an incorrect and confusing bit here, after reading the question properly (and giving it some thought) I fully support @Ethan Bolkers answer.

5
On

You've encountered a phenomenon called the AM-HM inequality, $\frac{1}{n}\sum_{i=1}^n x_i\ge\frac{n}{\sum_{i=1}^n\frac{1}{x_i}}$ for $x_i>0$, with equality iff all $x_i$ are equal. In general, functions don't commute with taking expectations; this is the example with the function $1/x$.

What you do with your data depends on what form you assume the distribution of retention times has. For example, suppose you think it has an Exponential distribution, with rate parameter $\lambda$. The fact that $1/\lambda$ is the MRT is then $1/\lambda=\int_0^\infty\lambda x\exp (-\lambda x)\mathrm{d}x$. I don't advise trying to estimate $\lambda$ from averaged reciprocals, since $\int_0^\infty\frac{\lambda}{x}\exp (-\lambda x)\mathrm{d}x$ is infinite.

Let's suppose for the sake of argument that we estimate $1/\lambda$ as the dataset's mean retention time. This is an example of the method of moments. It can be shown maximum likelihood estimation would recommend the same estimator. Pages 3 and 4 here discuss what happens with Bayesian estimation, and it comes to much the same thing for a large sample size. So if I were you, I'd estimate $1/\lambda$ as the mean GPR.

10
On

Here's an everyday puzzle that may help.

If you travel from here to there at $30$ miles per hour and back at $60$ miles per hour, what is your average speed? Instinct says it should be the average, which would be $45$ miles per hour.

But speed is (total distance)/(total time). You don't have a distance given, but you can make one up. Suppose your destination was $60$ miles away. Then it took you $2$ hours to get there and $1$ to get back. You drove $120$ miles in $3$ hours so your average speed was $40$ miles per hour.

The moral of the story is that you can't naively average averages, and a rate is an average. So be careful when you have to compute an average rate.

In your case your MRT is like the reciprocal of the speed, whose units are hours/mile. In my example those are $2$ hours per $60$ miles for the slow trip and $1$ hour per $60$ miles for the fast return. You can average those to get the average number of hours per mile. The average is $1.5$ hours per $60$ miles. The reciprocal is $60$ miles per $1.5$ hours, or $40$ miles per hour.

So this is right:

take the average of the MRTs and then take the inverse for calculating the gastric passage rate (first way)

Edit in light of many comments and clarifications.

The important question is "what is the right way to average the MRT values?", not "why do these two methods differ?" or even "which of these two is right?"

The answer depends on what MRT actually measures. If material moves through the gut at a constant rate then your first method is correct, as discussed above. But if material leaves the gut at a rate proportional to the amount present - that is, a fraction of the amount leaves per hour - then the process is like exponential decay. I don't know a right way to compute the average rate in that case. If you have very few values to average and they are not very different then you may be able to argue that whatever results you get are essentially independent of the way you average the rates.

2
On

One way to handle questions like this is to reduce it to the simplest possible version of the question and then examine that problem. In this case,

 Why is the inverse of the average of x and y not equal to 
 the average of the inverses of x and y?

So you are asking "Why isn't this true?" $$\dfrac{1}{\left( \dfrac{x+y}{2} \right)} = \dfrac{\left( \dfrac 1x + \dfrac 1y \right)}{2}$$

Personally, I would be suprised if the two sides turned out to be equal. But we can just solve the equation and see what happens.

\begin{align} \dfrac{1}{\left( \dfrac{x+y}{2} \right)} &= \dfrac{\left( \dfrac 1x + \dfrac 1y \right)}{2} \\ \dfrac{1}{\left( \dfrac{x+y}{2} \right)} \cdot \dfrac 22 &= \dfrac{\left( \dfrac 1x + \dfrac 1y \right)}{2} \cdot \dfrac{xy}{xy} \\ \dfrac{2}{x+y} &= \dfrac{x+y}{2xy} \\ (x+y)^2 &= 4xy \\ x^2 - 2xy + y^2 &= 0 \\ (x-y)^2 &= 0 \\ x-y &= 0 \\ x &= y \end{align}

The two sides are equal when $x = y$. Otherwise they are not.

If the question won't work, in general, for two variables, then it probably won't work, in general, for more than two variables.

0
On

You've stumbled upon one version of a more general phenomenon, the root of which is that averages (expectations) are a linear operation but inverses are non-linear and our linear intuition falls short.

One version of generalizing what you observed here is Jensen's inequality, which states that, for a convex function ("curved upwards", like $\frac1x$ is), the value of applying the function to the average will be at most the value of applying an average to the function, or in symbols:

$$ f(\mathbb{E}[X]) \leq \mathbb{E}[f(X)] $$

There is a nice graphical proof (see the Wikipedia article), but getting it might require some baseline intuition for probabilities & expectations.

0
On

You should also consider, in determining an appropriate solution method, that 'average' is a lay/common term used to describe the arithmetic mean. There are many other choices of averaging function that you could select for this data. As a first suggestion, try the geometric mean: $$G(\mathbb{x}) = \sqrt[\leftroot{-3}\uproot{3}n]{x_1 \cdot x_2 \cdots x_n}$$ You should notice that if $\mathbb{y}=(\frac{1}{x_1},\frac{1}{x_2},\ldots,\frac{1}{x_n})$ then $$\frac{1}{G(\mathbb{y})} = G(\mathbb{x}).$$

0
On

Short answer: The complete units don't match.

You have four retention events of durations $5$, $10$, $4$, and $2$ hours.

The average retention duration is $\frac{1}{4 \,\text{events}}(5 \,\text{h} + 10 \,\text{h} + 4 \,\text{h} + 2 \,\text{h}) = 5.25$ hours per event. Its reciprocal is $0.19\dots$ events per hour.

The retention rates (events per hour) are $\frac{1}{5}$, $\frac{1}{10}$, $\frac{1}{4}$, and $\frac{1}{2}$ reciprocal hours. So the average retention rate is $\frac{1}{4 \,\text{events}}\left( \frac{1}{5} \,\text{h}^{-1} + \frac{1}{10} \,\text{h}^{-1} + \frac{1}{4} \,\text{h}^{-1} + \frac{1}{2} \,\text{h}^{-1} \right) = 0.2625$ reciprocal hours per event.

Why would you expect the number of events per hour to be the same as the number of reciprocal hours per event?

The average gastric passage rate should have units of events per hour, so you want to use the first method, yielding $0.19\dots$ events per hour.

0
On

Contributors have made many useful comments on this, but unless I missed it, no-one has mentioned the other kind of mean that is involved here - viz the harmonic mean, which is the reciprocal of the arithmetic mean of the reciprocals.

The example of the miles/hour is a helpful everyday one; another common motoring one is miles per gallon, which if averaged yields an incorrect result. This is because miles per gallon is a measure not of consumption but of economy. In the metric world there is a true measure of consumption - litres per 100km, which CAN be averaged.

Another one is in the investment world, and is often called pound-cost averaging.

Suppose you invest £100 a month in a share that is volatile , i.e. that varies in price. You get more when the share is cheaper and less when it is more expensive. So the average per-unit price paid is less than the average price. Exactly the same mistake as if you try to average mph or mpg. To calculate the true average price you need the harmonic mean, the reciprocal of the arithmetic mean of the reciprocals. So far as I know, no-one else has associated the term "harmonic mean" with pound-cost averaging, and I'm pleased to offer it here for consideration by others.

In this case, the mean gastric passage rate is the harmonic mean of the individual GPRs - but since you have the reciprocals already given, in the MRTs, it's simpler to take the arithmetic mean of the MRTs, and then finally to determine the reciprocal. i.e. the first method is correct.

0
On

The short answer is that taking inverses is not a linear operation. This is almost tautological, in so far that a linear operation is one that "behaves well" with respect to linear combinations, in the sense that the operation applied to a linear combination of values gives the same result as taking the same linear combination of the outcomes of the operation applied to those values; the average of $n$ values is a special case of a linear combination of those values (namely the sum of $\frac1n$ times each value).

The only reason this short answer is interesting is that linear operations have been classified, so one can usually tell by inspection whether an operation is linear or not. For operations that produce a single number form a single number, the only linear operations are multiplication by a fixed number (so for instance tripling is a linear operation). Taking the inverse of a number is not of this form, and it is not linear. Nor are taking the square, the square root, or the logarithm; you will find that each of those operations also fail to behave well for (the technical term is "commute with") taking averages in the sense of your question (the square of the average is not the average of the squares, and so forth).

0
On

Just to answer the question "which way is right":

If you have the MRTs for some patients, and you want the average gastric passage rate, the right thing to do is convert all the numbers to gastric passage rates by taking the reciprocal, and then take the average. In other words, the Second Way is right.

As for the reason the two numbers are different, a lot of the other explanations just repeat using formulas what you saw for yourself with example numbers. I would say this: taking the inverse squeezes big numbers closer together, and makes small numbers farther apart. If, instead of taking the inverse, you were multiplying each number by 5, say, then the spacing between the numbers would be modified in a uniform way, and then your two methods actually would be the same.

0
On

You already got many answers why it doesn't work for a "normal" arithmetic average.

In fact there exists a type of average for which this is true.

It would be the same if you were using a geometric mean instead of an arithmetic mean.

In that case, the algebra becomes:

$$\sqrt[N]{\prod_1^N a_i} = \sqrt[N]{a_1\cdots a_N} = a_1^{1/N}\cdots {a_N}^{1/N} = \\\frac{1}{{a_1}^{-1/N}\cdots {a_N}^{-1/N}} = \frac{1}{\displaystyle\sqrt[N]{\prod_1^N {a_i}^{-1}}} = \frac{1}{\displaystyle\sqrt[N]{\prod_1^N \frac 1{a_i}}}$$