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

josef.pktd@gmai... josef.pktd@gmai...
Mon Oct 4 12:30:35 CDT 2010

On Mon, Oct 4, 2010 at 1:03 PM, Robert Kern <robert.kern@gmail.com> wrote:
> On Mon, Oct 4, 2010 at 11:35, Wes McKinney <wesmckinn@gmail.com> wrote:
>> 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.
> I think fixes like this are perfectly appropriate and shouldn't
> interfere with anyone's plans, if there are any.

We have been improving a lot of this precision problems (and bug
fixes) over the last two years. And there are still many left. Any
improvements are very welcome.

What's contentious is the big picture and the fit function, where I
still don't know how far I want to fork it.

(And don't use python's math module if you want to be robust to funny cases.)


> --
> 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
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user

More information about the SciPy-User mailing list