[SciPy-dev] help with special.nbdtrc

josef.pktd@gmai... josef.pktd@gmai...
Sun Nov 16 08:23:23 CST 2008


Is there a function in scipy.special equivalent to special.nbdtrc
that also works when the second coefficient is smaller than one?

>>> special.nbdtrc(2, 4.5, 0.42)
0.79201423936000004
>>> special.nbdtrc(2, 0.4 , 0.42)
1.#QNAN


the reason:
according to http://scipy.org/scipy/scipy/ticket/583
nbinom should also work for all parameters smaller than one,
but the survival function uses special.nbdtrc

class nbinom_gen(rv_discrete):
    def _sf(self, x, n, pr):
        k = floor(x)
        return special.nbdtrc(k,n,pr)

>>> print stats.nbinom.sf(0,4.4, 0.42)
0.96888304
>>> print stats.nbinom.sf(0,0.4, 0.42)
1.#QNAN


I can work around the problem, since I can easily calculate
the sf without specifying a specific formula for it.

Josef


More information about the Scipy-dev mailing list