[SciPy-User] scipy.stats.poisson, strange output?
nicky van foreest
vanforeest at gmail.com
Sun Feb 5 15:41:39 EST 2012
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.
>
>>>> 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 at scipy.org
>> http://mail.scipy.org/mailman/listinfo/scipy-user
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
More information about the SciPy-User
mailing list