[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug in geomean()
From: |
Jordi Gutiérrez Hermoso |
Subject: |
Re: Bug in geomean() |
Date: |
Mon, 1 Oct 2012 10:50:02 -0400 |
On 1 October 2012 10:36, kyfsympsn <address@hidden> wrote:
> Hi,
>
> Think I've noticed a big in the geomean(x) function (which can be also
> written as mean(x,"g"))
>
> In matlab, the following code:
> x = rand(1000,1);
> y=geomean(x)
> z=exp(mean(log(x)))
>
> ...will give the same value for y and z (roughly 0.3664)
>
> However in octave y =0!!
Geomean is implemented in the NaN package. It is not part of core
Octave. Should it be? Is it part of core Matlab?
> I think octave is probably calculating the geometric mean by
Think no more, know:
http://hg.savannah.gnu.org/hgweb/octave/file/e8b117b405f9/scripts/statistics/base/mean.m#l112
Or from Octave:
edit mean
type mean
I think it's a good habit to inspect the source code if you want to
know how something is being done.
Can you provide a patch? It should take into account the cases of
complex, negative, or zero entries.
- Jordi G. H.
- Bug in geomean(), kyfsympsn, 2012/10/01
- Re: Bug in geomean(),
Jordi Gutiérrez Hermoso <=