[Scipy-tickets] [SciPy] #865: Kendalltau divides by zero

SciPy scipy-tickets@scipy....
Wed Feb 4 03:06:49 CST 2009


#865: Kendalltau divides by zero
-------------------------+--------------------------------------------------
 Reporter:  icmurray     |       Owner:  somebody                                   
     Type:  defect       |      Status:  new                                        
 Priority:  normal       |   Milestone:  StatisticsCleanup                          
Component:  scipy.stats  |     Version:  devel                                      
 Severity:  normal       |    Keywords:  kendalltau cleanup stats divide by zero nan
-------------------------+--------------------------------------------------
 It may be that I have not understood the definition of the kendall-tau
 properly, but I think there is a problem with the kendalltau when one or
 both input lists ranks all elements as being equal.  In particular:


 {{{
 >>> from scipy.stats import kendalltau
 >>> kendalltau([1,1,1],[3,3,3])
 (nan, nan)
 >>> kendalltau([1,1,1],[3,3,0])
 (nan, nan)
 }}}


 Now, according to the wikipedia entry for kendall tau:
 http://en.wikipedia.org/wiki/Kendall%27s_tau

 I'd expect:
 {{{
 >>> kendalltau([1,1,1],[3,3,3])[0] = 0
 }}}
 Since the number of concordant pairs is 6, the number of discordant pairs
 is 6, and the total number of possible pairs is 6. i.e. (6 - 6)/6 = 0

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


More information about the Scipy-tickets mailing list