[Scipy-tickets] [SciPy] #1398: problem with numpy 0's in stats.poisson.rvs

SciPy Trac scipy-tickets@scipy....
Tue Mar 1 21:18:14 CST 2011


#1398: problem with numpy 0's in stats.poisson.rvs
-------------------------+--------------------------------------------------
 Reporter:  parejkoj     |       Owner:  somebody
     Type:  defect       |      Status:  new     
 Priority:  normal       |   Milestone:          
Component:  scipy.stats  |     Version:  0.8.0   
 Keywords:               |  
-------------------------+--------------------------------------------------

Comment(by josefpktd):

 just a check on some other methods, mu=0 returns nans, but mu=1e-16 looks
 good.
 Do we really need degenerate boundary cases?

 {{{
 >>> stats.poisson.expect(args=(0.1,))
 0.10000000000000002
 >>> stats.poisson.expect(args=(0,))
 nan
 >>> stats.poisson.expect(args=(1e-10,))
 1.0000000000000015e-010
 >>> stats.poisson.pmf(0,1e-15)
 0.999999999999999
 >>> stats.poisson.pmf(0,1e-16)
 0.99999999999999989
 >>> stats.poisson.pmf(0,0)
 nan
 >>> stats.poisson.cdf(0,0)
 nan
 >>> stats.poisson.cdf(0,1e-16)
 0.99999999999999989
 }}}


 another bug, pmf sometimes requires only one argument, instead of 2 (which
 is correct)

 {{{
 >>> stats.poisson.pmf(1)
 Traceback (most recent call last):
   File "<pyshell#42>", line 1, in <module>
     stats.poisson.pmf(1)
   File
 "C:\Josef\_progs\Subversion\scipy_trunk_g09\dist\scipy-0.10.0.dev7027.win32\Programs\Python25\Lib
 \site-packages\scipy\stats\distributions.py", line 5049, in pmf
     place(output,cond,self._pmf(*goodargs))
 TypeError: _pmf() takes exactly 3 arguments (2 given)
 >>> stats.poisson.pmf(1e-15)
 0.0
 >>> stats.poisson.pmf(0.1)
 0.0
 >>> stats.poisson.pmf(0.9)
 0.0
 >>> stats.poisson.pmf(1.0)
 Traceback (most recent call last):
   File "<pyshell#46>", line 1, in <module>
     stats.poisson.pmf(1.0)
   File
 "C:\Josef\_progs\Subversion\scipy_trunk_g09\dist\scipy-0.10.0.dev7027.win32\Programs\Python25\Lib
 \site-packages\scipy\stats\distributions.py", line 5049, in pmf
     place(output,cond,self._pmf(*goodargs))
 TypeError: _pmf() takes exactly 3 arguments (2 given)
 >>> stats.poisson.pmf(1.5)
 0.0
 }}}

-- 
Ticket URL: <http://projects.scipy.org/scipy/ticket/1398#comment:2>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.


More information about the Scipy-tickets mailing list