# [Tutor] Gamma distribution function

culpritNr1 ig2ar-saf1 at yahoo.co.uk
Tue Jan 13 23:11:05 CET 2009

```Hi Jarvis,

I tried the scipy function. I don't understand it. Look, if you go to
http://en.wikipedia.org/wiki/Poisson_Distribution wiki's Poisson
distribution documentation  you'll find that this is the naive way to
compute a Poisson probability mass function

>>> lam = 1
>>> k = 2
>>> math.exp(-lam) * lam**k / factorial(k)
0.18393972058572117

Notice that it matches the figure in the wiki page (the red curve).

Now, the scipy module does this:
>>> stats.distributions.poisson.rvs(1, 2)
array([3])
>>> stats.distributions.poisson.rvs(1, 2)
array([2])
>>> stats.distributions.poisson.rvs(1, 2)
array([2])
>>> stats.distributions.poisson.rvs(1, 2)
array([4])
>>> stats.distributions.poisson.rvs(1, 2)
array([3])
>>> stats.distributions.poisson.rvs(1, 2)
array([2])

The python documentation on this functionality is extremely poor. Look
>>> help("scipy.stats.distributions.poisson.rvs")
Help on method rvs in scipy.stats.distributions.poisson:
scipy.stats.distributions.poisson.rvs = rvs(self, *args, **kwds) method of
scipy.stats.distributions.poisson_gen instance

Do you understand what's going on?

Thanks,

culpritNr1

--
View this message in context: http://www.nabble.com/Gamma-distribution-function-tp21444899p21445597.html
Sent from the Python - tutor mailing list archive at Nabble.com.

```