[Scipy-tickets] [SciPy] #869: stats.invnorm.cdf returns NaNs with low mu values

SciPy Trac scipy-tickets@scipy....
Mon Aug 22 04:21:19 CDT 2011


#869: stats.invnorm.cdf returns NaNs with low mu values
--------------------------+-------------------------------------------------
  Reporter:  jpaalasm     |       Owner:  somebody
      Type:  defect       |      Status:  closed  
  Priority:  normal       |   Milestone:  0.10.0  
 Component:  scipy.stats  |     Version:  devel   
Resolution:  fixed        |    Keywords:          
--------------------------+-------------------------------------------------
Changes (by rgommers):

  * status:  needs_review => closed
  * resolution:  => fixed


Comment:

 Added the doc note and code comment, plus improved the numerical accuracy
 slightly in commit:ff96ef07.

 Improved accuracy due to inf * 0 --> inf/2 * 0 * inf/2.
 {{{
 >>> x = np.arange(0.0015, 0.0025, 0.0001)
 >>> mu = 0.002
 >>> from scipy import stats
 >>> stats.invgauss.cdf(x, mu)
 array([  5.41193695e-11,   2.86651572e-07,   1.37363382e-04,
          9.21106273e-03,   1.25674554e-01,   5.00000000e-01,
          8.62383238e-01,   9.83496871e-01,   9.99119149e-01,
          9.99977721e-01])
 >>> stats.invgauss.cdf(x, mu*0.75)
 array([ 0.5       ,  0.95220965,  0.99938924,  0.99999879,  1.        ,
         1.        ,  1.        ,  1.        ,  1.        ,  1.        ])
 >>> stats.invgauss.cdf(x, mu*0.5)
 array([ nan,  nan,  nan,  nan,  nan,  nan,  nan,  nan,  nan,  nan])
 }}}

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


More information about the Scipy-tickets mailing list