[Scipy-tickets] [SciPy] #1802: Infinite time taken by scipy hypergeom function for some particular values

SciPy Trac scipy-tickets@scipy....
Wed Jan 2 07:57:36 CST 2013


#1802: Infinite time taken by scipy hypergeom function for some particular values
-------------------------+--------------------------------------------------
 Reporter:  imsc         |       Owner:  somebody    
     Type:  defect       |      Status:  needs_review
 Priority:  normal       |   Milestone:  Unscheduled 
Component:  scipy.stats  |     Version:  0.11.0      
 Keywords:               |  
-------------------------+--------------------------------------------------

Comment(by josefpktd):

 Yes, calculating the ppf was not using the correct limits to search in.

 My impression is that it is now also much faster, since in this case the
 support of the distribution is not very large.

 With the fix in ticket:1803 I now get:

 {{{
 >>> from scipy import stats
 >>> stats.hypergeom.ppf(.975, 187601, 43192, 757)
 197.0
 >>> stats.hypergeom.ppf(.99, 187601, 43192, 757)
 202.0
 >>> stats.hypergeom.ppf(.995, 187601, 43192, 757)
 205.0
 >>> stats.hypergeom.ppf(.999,187601, 43192, 757)
 211.0
 >>> stats.hypergeom.ppf(.999999,187601, 43192, 757)
 231.0
 }}}

 There are still limitations on how much precision we get in the tail
 (which we won't be able to remove with floating point calculations)

 {{{
 >>> stats.hypergeom.pmf(700,187601, 43192, 757)
 0.0
 >>> stats.hypergeom.logpmf(700,187601, 43192, 757)
 -847.84226472990304
 >>> stats.hypergeom.cdf(700,187601, 43192, 757)
 0.99999999979663756
 >>> stats.hypergeom.ppf(0.99999999979663756,187601, 43192, 757)
 378.0
 }}}

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


More information about the Scipy-tickets mailing list