![](https://secure.gravatar.com/avatar/701f687f15b2ced9faae092feadcd825.jpg?s=120&d=mm&r=g)
May 22, 2002
8:52 p.m.
I submitted this to the Sourceforge bug tracker, but wanted also to let this list know, as this is a potentially nasty bug. MLab.std() gives completely incorrect answers for multidimensional arrays when axis != 0.
The following should fix the problem (but I haven't tested it extensively): def std(m,axis=0): """std(m,axis=0) returns the standard deviation along the given dimension of m. The result is unbiased with division by N-1. If m is of integer type returns a floating point answer. """ x = asarray(m) n = float(x.shape[axis]) x2 = mean(x * x, axis) x = mean(x, axis) return sqrt((x2 - x * x) * n /(n-1.0)) Jonathan Gilligan
8304
Age (days ago)
8305
Last active (days ago)
1 comments
2 participants
participants (2)
-
John J. Lee
-
Jonathan M. Gilligan