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

nicky van foreest vanforeest@gmail....
Sat Feb 4 17:12:27 CST 2012


I used two types of poisson, and obtained different results. Specifically:

In [1]: from scipy.stats import poisson

In [2]: import numpy as np

In [3]: grid = np.arange(20)

In [4]: rv = poisson(10)

In [5]: print rv.pmf(grid)
[  4.53999298e-05   4.53999298e-04   2.26999649e-03   7.56665496e-03
   1.89166374e-02   3.78332748e-02   6.30554580e-02   9.00792257e-02
   1.12599032e-01   1.25110036e-01   1.25110036e-01   1.13736396e-01
   9.47803301e-02   7.29079462e-02   5.20771044e-02   3.47180696e-02
   2.16987935e-02   1.27639962e-02   7.09110899e-03   3.73216263e-03]

In [6]: print poisson.pmf(10., grid)
[             nan   1.01377712e-07   3.81898506e-05   8.10151179e-04
   5.29247668e-03   1.81327887e-02   4.13030934e-02   7.09832687e-02
   9.92615338e-02   1.18580076e-01   1.25110036e-01   1.19378060e-01
   1.04837256e-01   8.58701508e-02   6.62818432e-02   4.86107508e-02
   3.40976998e-02   2.29995844e-02   1.49851586e-02   9.46624674e-03]

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?


More information about the SciPy-User mailing list