Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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?

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

1 Answer 1

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.

share|improve this answer
    
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))? –  betatester07 Jun 15 at 16:01
    
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. –  Stephen Montgomery-Smith Jun 15 at 19:31
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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