4
$\begingroup$

I am working with really small values of probabilities and that is why their log values are used. So for example, let probA and probB be some normal values of probabilities of two events and because they are very small, I use log values of them, $ln(probA)$ and $ln(probB)$.

I would like to compute arithmetic mean of this two values to compare them with other such pairs. Because they are very small, it is not a good idea to compute arithmetic mean like

$$\frac{e^{ln(probA)} + e^{ln(probB)}}{2}$$

Would it be mathematically correct only to compute arithemtic mean of the log values? Or is there any other better way to do it?

$\endgroup$
5
  • $\begingroup$ Arithmetic mean of log values = $\log($Geometric mean of original values$)$. $\endgroup$
    – M. Vinay
    Jun 15, 2014 at 14:29
  • $\begingroup$ Are you looking for the arithmetic mean of the log values or the log of the arithmetic mean of the original values? $\endgroup$
    – Henry
    Jun 15, 2014 at 14:31
  • $\begingroup$ I am looking for the log of the arithmetic mean of the original values, but I have only log values of the original values $\endgroup$ Jun 15, 2014 at 14:35
  • $\begingroup$ and I don't want to work with original values $\endgroup$ Jun 15, 2014 at 14:50
  • $\begingroup$ There's nothing wrong with just working with logs all the way. Compute the means, compare etc. $\endgroup$
    – PA6OTA
    Jun 15, 2014 at 15:01

1 Answer 1

2
$\begingroup$

What you really want is the $\ln$ of the arithmetic mean. That is: $$ \ln\left(\frac12(e^{\ln(\Pr(A))} + e^{\ln(\Pr(B))}\right ) .$$ Assume without loss of generality that $\Pr(A) \ge \Pr(B)$. Factor it: $$ -\ln(2) + \ln(\Pr(A)) + \ln\left(1 + e^{\ln(\Pr(B)) - \ln(\Pr(A))}\right) .$$ Doing the computation like this will probably result in small numerical errors.

$\endgroup$
3
  • $\begingroup$ I am not sure if I understand it correctly, but would it be possible to do without computing e^ln(Pr(B))−ln(Pr(A))? $\endgroup$ Jun 15, 2014 at 16:01
  • $\begingroup$ I don't think you can avoid the calculation $e^{\ln(\Pr(B))-\ln(\Pr(A))}$. There is only one formula for the arithmetic mean, and all you can do is to rearrange it. However, if $\Pr(A) \gg \Pr(B)$, then $\ln(\Pr(B))-\ln(\Pr(A))$ will be a large negative number, and so $e^{\ln(\Pr(B))-\ln(\Pr(A))}$ will be very close to zero. This means (a) that you can use the Taylor series expansion of $\ln(1+x)$ with only a few terms, and (b) if $e^{\ln(\Pr(B))-\ln(\Pr(A))}$ is so small that is causes an underflow, then you can replace it by zero. $\endgroup$ Jun 15, 2014 at 19:31
  • $\begingroup$ Would I be correct in presuming that the first equation generalises to $$ \ln\left(\frac1N(e^{\ln(\Pr(A))} + e^{\ln(\Pr(B))} + ... + e^{\ln(\Pr(N))}\right ) ?$$ $\endgroup$
    – Myles
    Nov 16, 2018 at 9:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.