[OctDev] Function mean() fails with a complex matrix
Alois Schlögl
alois.schloegl at tugraz.at
Thu Mar 5 10:39:50 CST 2009
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Søren Hauberg wrote:
> tor, 05 03 2009 kl. 16:04 +0100, skrev Alois Schlögl:
>> Or can You think of any reasonable problem, when mean should propagate
>> the NaN's ? I can not. Consequently, there is no need to have both
>> nanmean and mean.
>
> I guess this depends on how you interpret NaN. I think it makes sense to
> skip NA (not available) when computing mean values. But if NaN is the
> result of some faulty calculation somewhere in your program, then it can
> be nice to see the NaN's propagate. Otherwise you might never notice you
> had a bug.
>
> Søren
>
Skipping NA/NaN is valid for the mean as well as for any other
statistical estimate. I agree that this rule is not necessarily
applicable to other (non-statistical) fields. Specifically, sum() should
*never* be replaced by sumskipnan(); we need both sum() as well as
sumskipnan().
This mean/nanmean issue is mostly an issue of the statistical toolbox.
Moreover, several statistical functions like min() and max() do already
skip NaN's instead of propagating them. I'm just saying that this is
applicable to other statistical functions as well, and it would simplify
things from a programming perspective, if there would be no need to
think about whether mean or nanmean is needed.
Alois
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkmwAFIACgkQzSlbmAlvEIiLkACfUUyV43ub4HstZDJToSQ1xza9
ME0An2/E6csWyATEn9ognGFLGBZeRf07
=Oio4
-----END PGP SIGNATURE-----
More information about the Bug-octave
mailing list