[Scipy-tickets] [SciPy] #1852: Bug in spearmanr function to calculate correlation

SciPy Trac scipy-tickets@scipy....
Tue Feb 26 06:29:20 CST 2013


#1852: Bug in spearmanr function to calculate correlation
--------------------------+-------------------------------------------------
  Reporter:  damani       |       Owner:  somebody   
      Type:  defect       |      Status:  closed     
  Priority:  normal       |   Milestone:  Unscheduled
 Component:  scipy.stats  |     Version:  0.11.0     
Resolution:  invalid      |    Keywords:  spearmanr  
--------------------------+-------------------------------------------------
Changes (by warren.weckesser):

  * keywords:  => spearmanr
  * resolution:  => invalid
  * status:  new => closed
  * component:  Other => scipy.stats


Comment:

 This is not a bug.  As josef pointed out, in the example
 spearmanr([1,2,3,4,5], [5,6,7,8,7]), there is a tie in the second set of
 number (7 occurs twice).  The value 0.825 comes from using the formula
 that assumes there are no ties.

 See the wikipedia article
 http://en.wikipedia.org/wiki/Spearman%27s_rank_correlation_coefficient; in
 particular, note that there are two formulas given.  The second, expressed
 in terms of d_i = x_i - y_i, is only valid when there are no ties.

-- 
Ticket URL: <http://projects.scipy.org/scipy/ticket/1852#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