Log transformation

159 Views Asked by At

Supose I have a series of numbers from 1 to 10. Their mean value is 5.5. Now supose I apply some transformation like $y=2x+1$. Now their mean value is 12. Now, if I want to get back the original mean, I apply the inverse function, which in this case is $x=(y-1)/2$.

Simple.

Now I want to do the same, but with the $log$ function.

So, I first apply the $y=log(x)$ function and then take the mean. I get a value of 1.51. But then, if I take the inverse $x=e^y$, I get a value of 4.53 and not the original 5.5.

What is happening?

3

There are 3 best solutions below

3
On BEST ANSWER

Your first function is linear. Your other one isn't. Calculating the mean is a linear process so it is maintained over your linear transformation while it isn't for a non-linear transformation.

1
On

Your first function is linear. Therefore, $$ \frac{1}{10}\sum_{i=1}^{10}f(X_i) = \frac{1}{10}\sum_{i=1}^{10}(2X_i + 1) = 2\frac{1}{10}\sum_{i=1}^{10}X_i + 1 = f\left(\frac{1}{10}\sum_{i=1}^{10}X_i\right). $$ This doesnt work for the logarithm and the exponential function, since these aren't linear.

0
On

What you call the mean is actually the arithmetic mean, $$ \mathrm{AM}(X) = \dfrac{1}{n} \cdot \sum\limits_{k=1}^{n} x_k. $$ The procedure that you describe in your question is the way the geometric mean is computed: $$ \begin{array}{rcccl} \exp\left( \mathrm{AM}(\ln(X)) \right) &=& \exp\left( \dfrac{1}{n} \cdot \sum\limits_{k=1}^{n} \ln(x_k) \right) \\ &=& \exp\left( \dfrac{1}{n} \cdot \ln\left( \prod\limits_{k=1}^{n} x_k \right) \right) \\ &=& \exp\left( \ln\left( \left( \prod\limits_{k=1}^{n} x_k \right)^{\frac{1}{n}} \right) \right) \\ &=& \left( \prod\limits_{k=1}^{n} x_k \right)^{\frac{1}{n}} &=& \mathrm{GM}(X). \end{array} $$

By an inequality known already by the Babylonians and formalized by Jensen, the geometric mean is always smaller or equal to the arithmetic mean, i.e. $$ \mathrm{GM}(X) \leq \mathrm{AM}(X). $$ The mathematical reason for this is that the logarithm is a concave (or negative convex) function. Unfortunately, the concept of convexity is often confused with the concept of non-linearity (see this or this).