comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: geometric mean?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: geometric mean? [message #21724 is a reply to message #21626] Fri, 08 September 2000 09:59 Go to previous message
noymer is currently offline  noymer
Messages: 65
Registered: June 1999
Member
In article <39B8B345.FDF4E45D@dkrz.de>,
Martin Schultz <martin.schultz@dkrz.de> wrote:
> Hi Andrew,
>
> I couldn't find such a routine either so I decided to hack it
> together using the algorithm you suggest but including some error
> cehcking and more caution with range limits or negative values. You
> can find geomean.pro on my web pages:
>
http://www.mpimet.mpg.de/~schultz.martin/idl/html/libmartin_ schultz.html
>
> Cheers,
> Martin
>

Dear Martin,

Thanks!!!

You include checking for negative values, which would mess
up the ALOG function.

Since I am taking geometric means of rates that are by
definition positive, I did not think of negative numbers.

There is a problem, though...

Someone please correct me if this is wrong; I'm not 100% sure.
The way I implemented the geometric mean was not the DEFINITION of
the geomean, but rather a computational SHORTCUT.

The DEFINITION goes something like:

GEOMEAN(Arr)=(PROD(Arr))^(1/n), where n is the number of elements,
and PROD is the product operator. Logging both sides gets rid of the
nasty "nth root" (i.e. ^(1/n)) and turns the product into a sum, which
is also nice. Then exponentiating un-transforms the log.

Clearly we can't log any negative number, but we can product a
bunch of numbers and then take an nth root of the result. And if there
are zero or an even number of negative numbers there will be a real
nth root, hence (I guess), the geomean would exist.

I don't know what the convention is with negative numbers, and
it doesn't affect me because I am using positive numbers, but maybe
someone out there knows:

(1) Is geomean by convention undefined if any numbers in the set
are negative?

(2) Is geomean always the positive nth root? geomean of -2 and -2
is +2?


Cheers,
Andrew



Sent via Deja.com http://www.deja.com/
Before you buy.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Minor ticks beyond last xtickv?
Next Topic: Re: Vectorization question

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 09:49:41 PDT 2025

Total time taken to generate the page: 0.40669 seconds