Hypergeometric distribution ?

Ivan Frohne frohne at gci.net
Thu Mar 1 19:55:37 EST 2001


----- Original Message -----
From: "Thomas Sicheritz-Ponten" <thomas at cbs.dtu.dk>

> Does anybody have a python function/class for calculating the
> hypergeometric distribution ?

The reference here is to the discrete hypergeometric
probability distribution, not the mathematical special function.

Calculating hypergeometric distribution probabilities
requires some utility functions -- factorial(n) and
log-factorial(n), n a non-negative integer.  Some care
needs to be taken to avoid impossible combinations of
parameters, and there are symmetries which can
be exploited.  Then, for large parameters, you need
to approximate using the normal, binomial or Poisson
distributions.  Your particular situation may allow
cutting some corners here.

You will probably end up translating Fortran or C
code, and you will end up with a package, not just
a function.

--Ivan Frohne





More information about the Python-list mailing list