Re: [Tutor] Gamma distribution function

2009-01-13 Thread Alan Gauld
"culpritNr1" wrote I tried the scipy function. I don't understand it. Try reading about it here: http://numpy.sourceforge.net/numdoc/HTML/numdoc.htm It explains the output format. I believe it applies to the scipy version as well as the numpy. The python documentation on this functionali

Re: [Tutor] Gamma distribution function

2009-01-13 Thread culpritNr1
I just figured it out myself. This is how to do it both the naive and the efficient way, respectively: >>> import math >>> from scipy import factorial >>> lam = 1 >>> k = 2 >>> math.exp(-lam) * lam**k / factorial(k) 0.18393972058572117 >>> from scipy import stats >>> stats.poisson.pmf(2,1) arra

Re: [Tutor] Gamma distribution function

2009-01-13 Thread Kent Johnson
On Tue, Jan 13, 2009 at 5:11 PM, culpritNr1 wrote: > > 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

Re: [Tutor] Gamma distribution function

2009-01-13 Thread culpritNr1
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(

Re: [Tutor] Gamma distribution function

2009-01-13 Thread Jervis Whitley
On Wed, Jan 14, 2009 at 8:27 AM, culpritNr1 wrote: > > > there some kind of random.poisson()? > > Thank you, > > culpritNr1 > > Hello try the scipy library: >>> from scipy import stats >>> lamb = 10 >>> stats.distributions.poisson.rvs(lamb, loc=0) array([5]) >>> stats.distributions.poisson.rvs(la

[Tutor] Gamma distribution function

2009-01-13 Thread culpritNr1
Hello All, OK. This time a less trivial question. Is there a function to enable us sample from a Poisson distribution? There is random.uniform, random.normalvariate(), random.expovariate()... Is there some kind of random.poisson()? Thank you, culpritNr1 -- View this message in context: ht