Talk:Kendall tau distance

message: I'm not a statistician, so I never heard of this notion; just came here because bubble sort distance redirects here. However, it strikes me that one point is important that is not discussed at all: are the lists supposed to contain the same set of elements but possibly in different order? It seems like that, since having distance 0 would not otherwise imply that the lists are equal. Also I note that having equal entries in the same list falsifies the count, as an extreme case a list with all terms equal would have distance 0 to any other list (and make the triangle inequality fail). It would be clearer to say that the notion applies to pairs of rankings, or permutations of n, if that is indeed intended.
Also if a list τ is explicitly (τ(1),τ(2),...,τ(n)) (which seems the most natural interpretation of the unexplained expression τ(i) that is used in the formulas), then the claim "it is equivalent to the number of swaps that the bubble sort algorithm would make to place one list in the same order as the other list" is not true. The sequences (2,4,1,3) and (3,4,1,2) have Kendall tau distance 1 (only the pair i=1, j=4 gives a different comparison), but it would take 5 adjacent transpositions to transform one sequence into the other (which sequence would moreover never by performed in bubble sort, since it only applies transpositions that put elements into the proper order). I can see that something can be corrected either by interpreting τ(i) differently, namely as the position of i in the list, assuming that it occurs exactly once, or by taking an unconventional view of what bubble sort does (interchanging values that have no values from the interval between them in the list, rather than neighbours), but wouldn't know which of the two to prefer. The first option would force the lists to have the same set of distinct elements in order for the formulas to make sense, thus "resolving" the difficulty I mentioned above.
Finally, if as suggested by the examples one is comparing two rankings of the same set that does not have any significant intrinsic ordering on them (such as a set of people), then any reference to bubble sort is really inappropriate, because sorting is about putting elements into the correct order for some intrinsically defined order, such as alphabetical order for strings. Please modify the text so that it makes a bit more sense. Marc van Leeuwen (talk) 13:42, 11 November 2011 (UTC)
replies: text: I think our confusion is coming from the fact that in your example you are trying to bubble sort to an "unnatural" order.  If you want to bubble sort (2,4,1,3) into (3,4,1,2), then you have to remember you are not sorting left to right, and so "adjacent neighbours" are not as the appear on screen.  The second list defines your target order, and so defines the neighbours.  To make things clearer, allow me to change your numbers to letters, so you want to sort (B,D,A,C) onto (C,D,A,B), then numbers refer to the positions in this array as displayed in this text (1,2,3,4).  In which case, your target ordering defines the neighbours for comparison, so the "leftmost" datapoint is i=3, which is next to 4 which is next to 1 which is next to 2.  So bubble sort first compares the objects as positions 3 and 4 and since A<C makes no swap.  Next it checks position 4 against 1 (remembering that 4 is LEFT of 1) and since C>B it will switch.  Next it compares position 1 against 2, and finds that C<D and so no switch.  Since the list are in matching order now, it won't do any more switches.  — Preceding unsigned comment added by 31.221.13.140 (talk) 10:05, 17 October 2012 (UTC)
thread_title:  Missing information 

message: I've slightly changed the definition of  \tau_1 and  \tau_2, to make it clearer.
I've moved from:
* \tau_1 and \tau_2 are the rankings of the elements in L1 and L2
to:
* \tau_1(i) and \tau_2(i) are the rankings of the element i in L1 and L2
Can you guys confirm that my modification is correct? Thanks --Larry.europe (talk) 23:59, 5 February 2014 (UTC)
thread_title:  Condition modification 

message: The lead section says "Kendall tau distance is also called bubble-sort distance since it is equivalent to the number of swaps that the bubble sort algorithm would make to place one list in the same order as the other list". But are they really equivalent? Consider the following ranks:
Person        	A	B	C
Rank by Height	1	3	2
Rank by Weight	3	1	2
The bubble sort distance is obviously 1 - we only have to swap A and B.
But the Kendall tau distance is 3:
 
Pair 	Height	Weight	Count
(A,B)	1 < 3 	3 > 1 	X
(A,C)	1 < 2 	3 > 2 	X
(B,C)	3 > 2 	1 < 2 	X
Please clarify this issue. --Erel Segal (talk) 19:40, 25 February 2017 (UTC)
thread_title:  Is Kendall-tau distance really the same as bubble-sort distance?