[SciPy-User] scipy.stats.poisson, strange output?

josef.pktd@gmai... josef.pktd@gmai...
Sun Feb 5 15:35:27 CST 2012


On Sun, Feb 5, 2012 at 3:41 PM, nicky van foreest <vanforeest@gmail.com> wrote:
> Hi Josef,
>
>> wrong sequence of arguments, the shape (mean) argument should be
>> second and first the values at which pmf is evaluated, i.e.
>
> Thanks. I discovered it just after your reply. I must admit that I
> find it more natural to first specify the distribution's parameters,
> such as mu for the Poisson distribution, and then specify the points
> at which to evaluate the pmf (or cdf, etc.) This explains the error.

I saw thatt you replied at the same time.

I find the current version easier to follow, reading "given the parameters"

pmf(x, theta) = Prob(x | theta)
cdf(x, theta) = F(x | theta)
pdf(x, theta) = f(x | theta)

(and we could even pretend we are Bayesians :)

Cheers,

Josef

>
>>
>>>>> stats.poisson.pmf(grid, 10)
>> array([ 0.0000453999297625,  0.0004539992976248,  0.0022699964881242,
>>        0.0075666549604141,  0.0189166374010354,  0.0378332748020708,
>>        0.0630554580034512,  0.090079225719216 ,  0.1125990321490201,
>>        0.1251100357211337,  0.1251100357211337,  0.1137363961101213,
>>        0.094780330091768 ,  0.0729079462244373,  0.0520771044460262,
>>        0.0347180696306844,  0.0216987935191777,  0.0127639961877516,
>>        0.0070911089931953,  0.0037321626279975])
>>
>> in the first case it's a frozen distribution
>>
>>>>> stats.poisson(10).pmf(grid)
>> array([ 0.0000453999297625,  0.0004539992976248,  0.0022699964881242,
>>        0.0075666549604141,  0.0189166374010354,  0.0378332748020708,
>>        0.0630554580034512,  0.090079225719216 ,  0.1125990321490201,
>>        0.1251100357211337,  0.1251100357211337,  0.1137363961101213,
>>        0.094780330091768 ,  0.0729079462244373,  0.0520771044460262,
>>        0.0347180696306844,  0.0216987935191777,  0.0127639961877516,
>>        0.0070911089931953,  0.0037321626279975])
>>
>> Josef
>>
>>>
>>> In [7]:
>>>
>>>
>>> So, in line [5], rv.pmf(grid)[0] is a number, while in [6],
>>> poisson.pmf(10,grid)[0] is nan. Am I doing something wrong, or is this
>>> an unintentional inconsistency?
>>>
>>> Nicky
>>> _______________________________________________
>>> SciPy-User mailing list
>>> SciPy-User@scipy.org
>>> http://mail.scipy.org/mailman/listinfo/scipy-user
>> _______________________________________________
>> SciPy-User mailing list
>> SciPy-User@scipy.org
>> http://mail.scipy.org/mailman/listinfo/scipy-user
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user


More information about the SciPy-User mailing list