Can some explain this strange behavior of the hypergeometric distribution in scipy?

I am running Python 2.6.5 on Mac OS X 10.6.4 (this is not the native version, I installed it myself) with Scipy 0.8.0. If I do the following:

>>> from scipy.stats import hypergeom
>>> hypergeom.sf(5,10,2,5)

I get an IndexError. Then I do:

>>> hypergeom.sf(2,10,2,2)
-4.44....

I suspect the negative value is due to bad floating point precision. Then I do the first one again:

>>> hypergeom.sf(5,10,2,5)
0.0

Now it works! Can someone explain this? Are you seeing this behavior too?

11
задан Björn Pollex 28 September 2010 в 12:55
поделиться