[Scipy-tickets] [SciPy] #1893: Binomial PMF returns incorrect answer

SciPy Trac scipy-tickets@scipy....
Wed Apr 17 19:44:30 CDT 2013


#1893: Binomial PMF returns incorrect answer
-------------------------+--------------------------------------------------
 Reporter:  uscjeremy    |       Owner:  rgommers   
     Type:  defect       |      Status:  new        
 Priority:  normal       |   Milestone:  Unscheduled
Component:  scipy.stats  |     Version:  0.12.0     
 Keywords:               |  
-------------------------+--------------------------------------------------
 scipy.stats.binom.pmf(1,1,1) should return 1. Instead, it returns nan,
 with the following error:

 /usr/local/lib/python2.7/dist-packages/scipy/stats/distributions.py:6602:
 RuntimeWarning: divide by zero encountered in log
   return combiln + k*np.log(p) + (n-k)*np.log(1-p)
 /usr/local/lib/python2.7/dist-packages/scipy/stats/distributions.py:6602:
 RuntimeWarning: invalid value encountered in multiply
   return combiln + k*np.log(p) + (n-k)*np.log(1-p)

 I am using the latest NumPy (1.7.1) and SciPy (0.12.0) built from sources.

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


More information about the Scipy-tickets mailing list