Math behind Kendall tau-b I was looking up the definition of Kendall's tau-b and noticed that there seems to be two distinct equations floating around:
Equation 1 (Wikipedia):
$ \tau_b = \dfrac{n_c - n_d}{\sqrt{ (n_0 - \sum t_i (t_i -1) / 2) (n_0 - \sum u_i (u_i -1) / 2) }}$
Equation 2 (NIST):
$ \tau_b = \dfrac{n_c - n_d}{\sqrt{ (n_c + n_d + t) (n_c + n_d + u) }}$
where

*

*$n_0$ = number of all possible pairs

*$n_c$ = number of concordant pairs

*$n_d$ = number of discordant pairs

*$t_i$ = number of tied values in the ith group of ties for X (according to Wikipedia)

*$u_i$ = number of tied values in the ith group of ties for Y

*$t$ = number of pairs where X is tied

*$u$ = number of pairs where Y is tied

My questions are technical:

*

*Is $t$ = $\sum t_i (t_i -1) / 2$? I don't understand Wikipedia's definition of $t_i$ (or $u_i$).

*Are the two denominators mathematically equivalent? In other words, are the two equations the same?

 A: *

*No. In general, they are different. $t_1$,..., are the number of X values tied for each value where there are ties.  The sum is the number of pairs where the X value is tied.  The $t$ in the NIST definition is the number of pairs tied in X only.  In a special case (i.e. no pairs tied in both X and Y), they are the same.

*The denominators are the same.

From Agresti's Analysis of Ordinal Categorical Data, Section 7.1.3
$$\frac{n(n-1)}2=n_c+n_d+T_X+T_Y-T_{XY}$$
where $T_X$ is the number of pairs tied on the X variable, $T_Y$ is the number of pairs tied on the Y variable, $T_{XY}$ is the number of pairs where both are tied, $n$, $n_c$, $n_d$ defined as in the question.
This equation comes from the fact that each pair is either counted among the concordant, discordant, or among one or both of the tied pairs. $T_{XY}$ needs to be subtracted because those pairs with both values tied are counted twice (once in $T_X$ and once in $T_Y$).
Note that $T_X-T_{XY}$ is the number of pairs tied on the X variable only.
Thus,
$$\frac{n(n-1)}2-T_Y=n_c+n_d+\text{number of pairs tied on X only}$$
Similarly,
$$\frac{n(n-1)}2-T_X=n_c+n_d+\text{number of pairs tied on Y only}$$
The left hand side is what you see in the Wikipedia definition. The right hand side is what you see in the NIST definition. On the NIST webpage, they define what you call $t$ as "the number of pairs tied for the first response variable only". Similarly, $u$ is the number of pairs tied in the second variable only.
