[SciPy-user] looking for a negative binomial distribution

Robert Kern robert.kern@gmail....
Sat Aug 23 00:41:06 CDT 2008

On Fri, Aug 22, 2008 at 21:58, Chris Fonnesbeck <listservs@mac.com> wrote:
> I notice in the scipy dev wiki that the negative binomial random number
> generator is broken. In particular, it appears to round the first parameter,
> which is incorrect -- any real number is valid, not just integers.

Ah. My apologies. The reference I was working from (Luc Devroye's
_Nonuniform Random Variate Generation, p.543) describes it as taking
an integer n and real p. Float arguments get cast to C longs and thus

> As a result, the method bombs out when passing it a parameter value of n<1,
> since it gets rounded to zero. This is a bit worrying for a common
> distribution like the NB, and it makes me wonder about other random number
> generators in numpy/scipy.

There was a bug found in the noncentral F distribution recently.

> Does anyone else know of a stable random number generating library for python?

PyGSL, if that's still a going concern. It would be nice, however, if
you helped me test the distributions, though.

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
 -- Umberto Eco

More information about the SciPy-user mailing list