[SciPy-User] Any planned work on scipy.stats.distributions?

Wes McKinney wesmckinn@gmail....
Mon Oct 4 11:35:58 CDT 2010


I'm starting to notice miscellaneous issues in
scipy.stats.distributions that should be worth fixing-- I can start
filing tickets but I wondered if there were generally any plans to
give the distributions a working over.

One example: gamma(n) = (n - 1)! obviously blows up when n is
sufficiently large. So basically anywhere special.gamma is used in a
calculation is potentially at risk. For example, in Bayesian inference
it's not uncommon to derive gamma posterior distributions with very
small scale, functions like pdf don't work:

class gamma_gen(rv_continuous):
    def _pdf(self, x, a):
        return x**(a-1)*exp(-x)/special.gamma(a)

# using rpy2
In [180]: list(r.dgamma(2.2, 2505, scale=1./1137))
Out[180]: [9.0521612284316788]

In [181]: stats.gamma(2505, scale=1./1137).pdf(2.2)
Out[181]: nan

I can fix some of these things (this one's easy-- take logs and use
gammaln) but wondered first if there were any other plans for this
code.

- Wes


More information about the SciPy-User mailing list