[SciPy-User] Any planned work on scipy.stats.distributions?
Robert Kern
robert.kern at gmail.com
Mon Oct 4 13:03:40 EDT 2010
On Mon, Oct 4, 2010 at 11:35, Wes McKinney <wesmckinn at 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.
--
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
More information about the SciPy-User
mailing list