[Numpy-discussion] Standard Deviation (std): Suggested change for "ddof" default value

josef.pktd at gmail.com josef.pktd at gmail.com
Tue Apr 1 17:18:13 EDT 2014

On Tue, Apr 1, 2014 at 5:11 PM, Nathaniel Smith <njs at pobox.com> wrote:
> On Tue, Apr 1, 2014 at 9:51 PM, Ralf Gommers <ralf.gommers at gmail.com> wrote:
>> On Tue, Apr 1, 2014 at 10:08 PM, Nathaniel Smith <njs at pobox.com> wrote:
>>> On Tue, Apr 1, 2014 at 9:02 PM, Sturla Molden <sturla.molden at gmail.com>
>>> wrote:
>>> > Haslwanter Thomas <Thomas.Haslwanter at fh-linz.at> wrote:
>>> >
>>> >> Personally I cannot think of many applications where it would be
>>> >> desired
>>> >> to calculate the standard deviation with ddof=0. In addition, I feel
>>> >> that
>>> >> there should be consistency between standard modules such as numpy,
>>> >> scipy, and pandas.
>>> >
>>> > ddof=0 is the maxiumum likelihood estimate. It is also needed in
>>> > Bayesian
>>> > estimation.
>>> It's true, but the counter-arguments are also strong. And regardless
>>> of whether ddof=1 or ddof=0 is better, surely the same one is better
>>> for both numpy and scipy.
>> If we could still choose here without any costs, obviously that's true. This
>> particular ship sailed a long time ago though. By the way, there isn't even
>> a `scipy.stats.std`, so we're comparing with differently named functions
>> (nanstd for example).
> Presumably nanstd is a lot less heavily used than std, and presumably
> people expect 'nanstd' to be a 'nan' version of 'std' -- what do you
> think of changing nanstd to ddof=0 to match numpy? (With appropriate
> FutureWarning transition, etc.)

numpy is numpy, a numerical library
scipy.stats is stats and behaves differently.  (axis=0)

nanstd in scipy.stats will hopefully also go away soon, so I don't
think it's worth changing there either.

pandas came later and thought ddof=1 is worth more than consistency.

I don't think ddof defaults's are worth jumping through deprecation hoops.

(bias in cov, corrcoef is "non-standard" ddof)


> --
> Nathaniel J. Smith
> Postdoctoral researcher - Informatics - University of Edinburgh
> http://vorpus.org
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion

More information about the NumPy-Discussion mailing list