Hypergeometric distribution

Raven balckraven at gmail.com
Sun Jan 1 17:24:39 EST 2006


Thanks Steven for your very interesting post.

This was a critical instance from my problem:

>>>from scipy import comb
>>> comb(14354,174)
inf

The scipy.stats.distributions.hypergeom function uses the scipy.comb
function, so it returned nan since it tries to divide an infinite. I
did not tried to write a self-made function using standard python as I
supposed that the scipy functions reached python's limits but I was
wrong, what a fool :-)

>If you are calculating hundreds of hypergeometric probabilities, 30
>seconds each could be quite painful, but it certainly shows that Python is
>capable of doing it without resorting to logarithms which may lose some
>significant digits. Although, in fairness, the log function doesn't seem
>to lose much accuracy for arguments in the range you are dealing with.

Yes I am calculating hundreds of hypergeometric probabilities so I need
fast calculations

Ale




More information about the Python-list mailing list