[Scipy-tickets] [SciPy] #1259: stats.spearmanr causes unnecessary divide-by-zero warnings

SciPy Trac scipy-tickets@scipy....
Sun Oct 3 12:05:43 CDT 2010


#1259: stats.spearmanr causes unnecessary divide-by-zero warnings
-------------------------+--------------------------------------------------
 Reporter:  zachrahan    |       Owner:  somebody
     Type:  defect       |      Status:  new     
 Priority:  normal       |   Milestone:  0.9.0   
Component:  scipy.stats  |     Version:  devel   
 Keywords:               |  
-------------------------+--------------------------------------------------

Comment(by zachrahan):

 How about this change? It should do the trick...

 {{{
     rs = np.corrcoef(ar,br,rowvar=axisout)
     if rs.shape == (2,2):
         rs = rs[1,0]

     t = rs * np.sqrt((n-2) / ((rs+1.0)*(1.0-rs)))
     prob = distributions.t.sf(np.abs(t),n-2)*2

     return rs, prob
 }}}

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


More information about the Scipy-tickets mailing list