[Scipy-tickets] [SciPy] #1895: stats binom at non-integer n

SciPy Trac scipy-tickets@scipy....
Fri Apr 19 07:34:59 CDT 2013


#1895: stats binom at non-integer n
-------------------------+--------------------------------------------------
 Reporter:  josefpktd    |       Owner:  rgommers   
     Type:  defect       |      Status:  new        
 Priority:  normal       |   Milestone:  Unscheduled
Component:  scipy.stats  |     Version:  0.12.0     
 Keywords:               |  
-------------------------+--------------------------------------------------
 stats.binom does not impose that n is an integer.

 The cdf seems to work correctly (?), the pmf doesn't sum to one.
 The cdf from scipy.special might just floor the argument n (cast to int).
 I don't know what to make of the case, when n is not an integer.
 Is there an extension of the distribution for all real n>=0?


 {{{
 >>> stats.binom.cdf(np.arange(-3,5), 3.5, 0.5)
 array([ 0.   ,  0.   ,  0.   ,  0.125,  0.5  ,  0.875,  1.   ,  1.   ])
 >>> np.diff(stats.binom.cdf(np.arange(-3,5), 3.5, 0.5))
 array([ 0.   ,  0.   ,  0.125,  0.375,  0.375,  0.125,  0.   ])
 >>> stats.binom.pmf(np.arange(-3,5), 3.5, 0.5)
 array([ 0.        ,  0.        ,  0.        ,  0.08838835,  0.30935922,
         0.38669902,  0.19334951,  0.        ])
 >>> stats.binom.pmf(np.arange(-3,5), 3.5, 0.5).sum()
 0.97779609585952287

 >>> stats.binom.pmf(np.arange(-3,5), 3, 0.5)
 array([ 0.   ,  0.   ,  0.   ,  0.125,  0.375,  0.375,  0.125,  0.   ])
 }}}

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


More information about the Scipy-tickets mailing list