thouis / numpy-trac-migration

numpy Trac to github issues migration
2 stars 3 forks source link

Variance can return negative values (Trac #2121) #5917

Open numpy-gitbot opened 11 years ago

numpy-gitbot commented 11 years ago

Original ticket http://projects.scipy.org/numpy/ticket/2121 on 2012-04-29 by atmention:charris, assigned to unknown.

Apropos ticket #1952, I don't think it is really fixed. The following should probably raise an error.

In [4]: x = np.array([1, 1, 2])

In [5]: x.var(ddof=10)
Out[5]: -0.095238095238095233

The nan for the std is an artifact of taking a square root. Robert, is there any use for negative variance?

For the 1.6.2 backport of #1952 I return nan in these circumstances, but that is a dirty fix.

numpy-gitbot commented 11 years ago

atmention:rkern wrote on 2012-04-29

No use.