[SciPy-User] Any planned work on scipy.stats.distributions?
Mon Oct 4 12:30:35 CDT 2010
On Mon, Oct 4, 2010 at 1:03 PM, Robert Kern <email@example.com> wrote:
> On Mon, Oct 4, 2010 at 11:35, Wes McKinney <firstname.lastname@example.org> 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 : list(r.dgamma(2.2, 2505, scale=1./1137))
>> Out: [9.0521612284316788]
>> In : stats.gamma(2505, scale=1./1137).pdf(2.2)
>> Out: 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
> 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
More information about the SciPy-User