[SciPy-dev] help with special.nbdtrc

josef.pktd at gmail.com josef.pktd at gmail.com
Sun Nov 16 09:23:23 EST 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