[Scipy-tickets] [SciPy] #1475: Bug in `stats.norm_rvs` function

SciPy Trac scipy-tickets@scipy....
Fri Jul 8 16:50:06 CDT 2011


#1475: Bug in `stats.norm_rvs` function
-------------------------+--------------------------------------------------
 Reporter:  rosalia      |       Owner:  somebody   
     Type:  defect       |      Status:  new        
 Priority:  normal       |   Milestone:  Unscheduled
Component:  scipy.stats  |     Version:  0.9.0      
 Keywords:               |  
-------------------------+--------------------------------------------------
 The T-test for the means of two independent samples of scores has a bug in
 the edge case where  a sample has variance zero. Below is an example:

 {{{
 >>> from scipy import stats
 >>> data1 =  [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
 >>> data2 =  [0.0, 0.0, 0.0, 0.0, 0.0]
 >>> stats.ttest_ind(data1,data2)
 /.virtualenvs/statmodels/lib/python2.6/site-
 packages/scipy/stats/stats.py:2925: RuntimeWarning: invalid value
 encountered in double_scalars
   t = d/np.sqrt(svar*(1.0/n1 + 1.0/n2))
 (1.0, 0.32771580614285878)
 }}}

 In this case the function should return "NaN" instead of `(1.0,
 0.32771580614285878)` because  the statistic t=(mean(x1)-mean(x2)) / SE
 is not defined since SE=0.

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


More information about the Scipy-tickets mailing list