Basic Concepts
Definition 1: Let x1, …, xn be a sample for random variable x and let y1, …, yn be a sample for random variable y of the same size n. There are C(n, 2) possible ways of selecting distinct pairs (xi, yi) and (xj, yj). For any such assignment of pairs, define each pair as concordant, discordant, or neither as follows:
- concordant if (xi > xj and yi > yj) or (xi < xj and yi < yj)
- discordant if (xi > xj and yi < yj) or (xi < xj and yi > yj)
- neither if xi = xj or yi = yj (i.e. ties are not counted).
Now let C = the number of concordant pairs and D = the number of discordant pairs. Then define tau as
Observations
If there are no ties, then C(n, 2) = C + D. Thus
To facilitate the calculation of C – D it is best to first put all the x data elements in ascending order. If x and y are perfectly positively correlated, then all the values of y would be in ascending order too, and so if there are no ties then C = C(n, 2) and τ = 1.
Otherwise, there will be some inversions. For each i, count the number of j > i for which xj < xi. This sum is D. If x and y are perfectly negatively correlated, then all the values of y would be in descending order, and so if there are no ties then D = C(n, 2) and τ = -1.
Properties
Proof: This is a result of the fact that there are C(n, 2) pairings with C(n, 2) = C + D + T where T = the number of tied pairs. Thus
τ is maximum when D = T = 0 and so τ = 1. τ is minimum when C = T = 0 and so τ = -1.
Worksheet Functions
Real Statistics Functions: The following functions are provided in the Real Statistics Resource Pack where the samples for z, x, and y are contained in R, R1, and R2 respectively.
KCORREL(R1, R2) = Kendall’s tau τx,y
PART_KCORREL(R, R1, R2) = partial correlation τzx,y of variables z and x holding y constant
SEMIPART_KCORREL(R, R1, R2) = semi-partial correlation τz(x,y)
Here, τzx,y and τz(x,y) are defined exactly as for rzx,y and rz(x,y) except that Kendall’s tau is used instead of Pearson’s correlation see Multiple Correlation).
References
eGyanKosh (2017) Unit 2: other types of correlation
http://egyankosh.ac.in/bitstream/123456789/20956/1/Unit-2.pdf
Wikipedia (2015) Kendall rank correlation coefficient
https://en.wikipedia.org/wiki/Kendall_rank_correlation_coefficient
dear charles ,
thanks for your site may i ask you send me a formula for ties in ranking
other than arithmetic mean , if possible
best regards
See the webpage Kendall’s Tau with Ties.
Charles
Hey Charles,
This is a great resource, do you have a source for the equations you gathered here?
-Joe
Thanks Joe,
The information comes from a few sources, but principally from [Ho] and [IB] in the Bibliography of the website.
Charles
Hi Charles,
I think the p-value calculation shown in your first example (Fig. 1, with no ties) should be =NORMSDIST(I11) not F11?
Thanks, KEH
Hi KEH,
Thanks for catching this typo. I have now changed the formula on the webpage as you have suggested.
Charles