[Scipy-tickets] [SciPy] #486: Built-in Poisson CDF and PMF function slower than using built-in gamma
SciPy
scipy-tickets@scipy....
Fri Aug 24 12:54:24 CDT 2007
#486: Built-in Poisson CDF and PMF function slower than using built-in gamma
-------------------------+--------------------------------------------------
Reporter: danhs | Owner: somebody
Type: defect | Status: new
Priority: normal | Milestone:
Component: scipy.stats | Version: 0.5.2
Severity: normal | Keywords: probability distribution, scipy.stats, speed, poisson, binomial
-------------------------+--------------------------------------------------
I'm not sure how or why, but scipy.stats.poisson.cdf is much slower than
using using the incomplete gamma function as defined on wikipedia
http://en.wikipedia.org/wiki/Poisson_distribution.
That is poisson_cdf(k, lam) = scipy.special.gammaincc(floor(k+1), lam).
The same is true for the binomial cdf:
binom_cdf(s, N, p) = scipy.special.betainc(N-floor(s), 1 + floor(s), 1-p).
And the binomial pmf:
binomPmf = lambda s, N, p: scipy.misc.comb(N, s) * p**s * (1-p)**(N-s)
I thought the situation with the normal distribution was similar, but to
be frank, I don't have that code written and I'm not sure I tested it.
This was run on Windows XP machine using Python 2.5.1. Scipy version used
is 0.5.2 Numpy version is 1.0.3
--
Ticket URL: <http://projects.scipy.org/scipy/scipy/ticket/486>
SciPy <http://www.scipy.org/>
SciPy is open-source software for mathematics, science, and engineering.
More information about the Scipy-tickets
mailing list