[SciPy-User] poisson distribution in scipy.stats

1 view
Skip to first unread message

Davide Cittaro

unread,
Nov 9, 2009, 3:58:28 PM11/9/09
to SciPy Users List
Hi all, 
about the poisson generator... given l (expected) and k (found) I guess that the way to get the probability of k I have to do this:


d = scipy.stats.poisson(l)
p = pmf(k)

which I found being the same of 

p = scipy.stats.poisson.pmf(l, k)

I've here some code in which it is written:

d = scipy.stats.poisson(l, k)
p = d.pmf(k)

which gives different results. Which is the right way to initialize the distribution (and get the PMF)?

Thanks

d


/*
Davide Cittaro

Cogentech - Consortium for Genomic Technologies
via adamello, 16
20139 Milano
Italy

*/



Robert Kern

unread,
Nov 9, 2009, 4:00:29 PM11/9/09
to SciPy Users List
On Mon, Nov 9, 2009 at 14:58, Davide Cittaro
<davide....@ifom-ieo-campus.it> wrote:
> Hi all,
> about the poisson generator... given l (expected) and k (found) I guess that
> the way to get the probability of k I have to do this:
>
> d = scipy.stats.poisson(l)
> p = pmf(k)

Correct.

> which I found being the same of
> p = scipy.stats.poisson.pmf(l, k)

Also correct.

> I've here some code in which it is written:
> d = scipy.stats.poisson(l, k)

That one is completely wrong.

--
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
SciPy...@scipy.org
http://mail.scipy.org/mailman/listinfo/scipy-user

Davide Cittaro

unread,
Nov 9, 2009, 4:21:59 PM11/9/09
to scipy...@scipy.org

On Nov 9, 2009, at 10:03 PM, scipy-use...@scipy.org wrote:

Message: 5
Date: Mon, 9 Nov 2009 15:00:29 -0600
From: Robert Kern <rober...@gmail.com>
Subject: Re: [SciPy-User] poisson distribution in scipy.stats
To: SciPy Users List <scipy...@scipy.org>
Message-ID:
<3d375d730911091300h6d...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8


On Mon, Nov 9, 2009 at 14:58, Davide Cittaro
<davide....@ifom-ieo-campus.it> wrote:
Hi all,
about the poisson generator... given l (expected) and k (found) I guess that
the way to get the probability of k I have to do this:

d = scipy.stats.poisson(l)
p = pmf(k)

Correct.

which I found being the same of
p = scipy.stats.poisson.pmf(l, k)

Also correct.


Although I've just plotted values and they are sligthly different... the second version does have only a max value at l, whereas the first has two maxima (l and l-1)


I've here some code in which it is written:
d = scipy.stats.poisson(l, k)

That one is completely wrong.


Ok, I see... It looks like it shifts the pmf of k... but how does it works? I mean, how the discrete distribution constructor interprets this kind of declaration?

josef...@gmail.com

unread,
Nov 9, 2009, 4:24:35 PM11/9/09
to SciPy Users List

k is interpreted as location
same as stats.poisson(l, loc=k)

loc shifts the distribution, and returns a frozen distribution with
shifted support

Josef


>
> That one is completely wrong.
>
>
> Ok, I see... It looks like it shifts the pmf of k... but how does it works?
> I mean, how the discrete distribution constructor interprets this kind of
> declaration?
> d
>
> /*
> Davide Cittaro
> Cogentech - Consortium for Genomic Technologies
> via adamello, 16
> 20139 Milano
> Italy
> tel.: +39(02)574303007
> e-mail: davide....@ifom-ieo-campus.it
> */
>
>
>

Robert Kern

unread,
Nov 9, 2009, 4:25:24 PM11/9/09
to SciPy Users List

I'm sorry. I meant "Wrong."

p = scipy.stats.poisson.pmf(k, l)

> I've here some code in which it is written:
>
> d = scipy.stats.poisson(l, k)
>
> That one is completely wrong.
>
>
> Ok, I see... It looks like it shifts the pmf of k... but how does it works?
> I mean, how the discrete distribution constructor interprets this kind of
> declaration?

Exactly as the documentation states:

myrv = poisson(mu,loc=0)
- frozen RV object with the same methods but holding the given
shape and location fixed.

--
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

Reply all
Reply to author
Forward
0 new messages