[Numpy-discussion] non-standard standard deviation

Anne Archibald peridot.faceted@gmail....
Sun Nov 29 16:13:05 CST 2009

2009/11/29 Dr. Phillip M. Feldman <pfeldman@verizon.net>:

> All of the statistical packages that I am currently using and have used in
> the past (Matlab, Minitab, R, S-plus) calculate standard deviation using the
> sqrt(1/(n-1)) normalization, which gives a result that is unbiased when
> sampling from a normally-distributed population.  NumPy uses the sqrt(1/n)
> normalization.  I'm currently using the following code to calculate standard
> deviations, but would much prefer if this could be fixed in NumPy itself:

This issue was the subject of lengthy discussions on the mailing list,
the upshot of which is that in current versions of scipy, std and var
take an optional argument "ddof", into which you can supply 1 to get
the normalization you want.


> def mystd(x=numpy.array([]), axis=None):
>   """This function calculates the standard deviation of the input using the
>   definition of standard deviation that gives an unbiased result for
> samples
>   from a normally-distributed population."""
> --
> View this message in context: http://old.nabble.com/non-standard-standard-deviation-tp26566808p26566808.html
> Sent from the Numpy-discussion mailing list archive at Nabble.com.
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion

More information about the NumPy-Discussion mailing list