[NumPy-Tickets] [NumPy] #1414: Possible mistake in distribution.c::rk_binomial_btpe

NumPy Trac numpy-tickets@scipy....
Sat Feb 27 01:25:16 CST 2010


#1414: Possible mistake in distribution.c::rk_binomial_btpe
--------------------------+-------------------------------------------------
 Reporter:  batz900       |       Owner:  somebody
     Type:  defect        |      Status:  new     
 Priority:  normal        |   Milestone:          
Component:  numpy.random  |     Version:  1.3.0   
 Keywords:                |  
--------------------------+-------------------------------------------------
Changes (by josefpktd):

 * cc: josefpktd (added)


Comment:

 Do you have an idea for which parameters the results might be incorrect. A
 quick check of a few examples looks pretty accurate.

 for example:

 {{{
 >>> rvs = np.random.binomial(5, 0.9,(1000000,5))
 >>> for i in range(5): print np.bincount(rvs[:,i])

 [    12    456   7913  72838 328808 589973]
 [    14    461   8107  72831 326595 591992]
 [     9    421   8204  72806 327239 591321]
 [    13    449   8017  72971 327909 590641]
 [    12    425   7961  72900 327891 590811]
 >>> (stats.binom.pmf(range(6),5,0.9)*1e6).astype(int)
 array([     9,    449,   8099,  72899, 328049, 590490])

 >>> rvs = np.random.binomial(5, 0.1,(1000000,5))
 >>> for i in range(5): print np.bincount(rvs[:,i])

 [590172 328315  73026   8058    420      9]
 [591287 327400  72754   8079    472      8]
 [590684 327706  73028   8128    439     15]
 [590410 328357  72747   8042    436      8]
 [590920 327802  72720   8076    469     13]
 >>> (stats.binom.pmf(range(6),5,0.1)*1e6).astype(int)
 array([590490, 328050,  72900,   8099,    450,     10])
 }}}

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/1414#comment:1>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list