rho = 1 - 6 SUM(d^{2})/(N^{3} - N),

where d_{i} is
the difference between the ranks of case *i* on the two variables. An obvious
way to extend this approach to tied ranks is to simply use the Pearson formula
to correlate the ranks, regardless of the number of ties. However, this
approach yields an index with no good interpretation. The Pearson correlation
itself draws its meaning from the fact that it is proportional to the linear
regression slope, and in a set of ordered categories the assumption of linearity
is extremely implausible.

The other well-known measure of rank correlation is the Kendall tau.
Like rho, in its original form tau assumes an absence of tied ranks. Tau uses
the concepts of concordance and discordance--concepts fundamental to all the
recommended measures in this section. Two cases are said to be concordant
on two ordinal variables *X* and *Y* if the case higher on *X*
is also higher on *Y*, and are discordant if the case higher on *X* is
lower on *Y*. The two cases are
neither concordant nor discordant if they are tied on *X* or *Y* or both.
Let the number of concordant and discordant pairs be denoted Con and Dis
respectively. The formulas in this section are intended to be conceptual only;
if you plan to compute any of these measures by hand, see the later section on
computational formulas.

The Kendall tau, which assumes no ties, is

tau = (Con - Dis)/total number of pairs

As mentioned above, ordinal scales have many ties, so for our purposes it is very important how one modifies this formula to handle ties. The Kendall tau-b and Stuart tau-c correct the original tau value for ties in different ways, but neither is as widely used as gamma, defined as

gamma = (Con - Dis)/(Con + Dis)

Thus gamma corrects for ties simply by ignoring all pairs tied on either *X* or
*Y*. Gamma is +1 if there are no discordant pairs, -1 if there are no
concordant pairs, and 0 if there are equal numbers of concordant and
discordant pairs. When gamma is applied to a 2 x 2 table with cell
frequencies labeled

A | B |

C | D |

*Q* = (AD - BC)/(AD + BC)

*Q* is the only measure in this document which is doubly margin-free; gamma is
not doubly margin-free when *r* or *c* exceeds 2.

Gamma is the best-known single measure for correlating two ordinal
scales. However, it has some limitations that are overcome by two alternative
statistics: Somers *D* and Symmetrically Adjusted Gamma (SAG).

The importance of this point is illustrated by the table

30 | 10 |

20 | 20 |

10 | 30 |

A | B |

C | D |

E | F |

50 | 30 |

10 | 30 |

A similar argument applies to causal analysis. When independent and
dependent variables are continuous, the standard measure of effect size is the
regression slope, which equals the estimated difference in *Y* for two cases that
differ one unit on *X*. More generally, a measure of effect size should measure
the differences between cases on a dependent variable given that the cases
differ on the independent variable. Thus pairs tied on the independent variable
should not be counted in measuring effect size. But if two cases are tied on
the dependent variable but not on the independent variable, that should lower
the measured effect size. Thus when measuring effect size, as when measuring
predictive accuracy, ties on the column variable should be treated differently
from ties on the row variable.

The Somers *D* statistic is a modification of gamma designed to handle
the problems just described. The conceptual formula for *D* (not recommended
for actual computation) is

*D* = (Con - Dis)/number of pairs in different columns

To compute *D*, think of all possible pairs including each case paired with
itself. If we count pair 1-2 as different from pair 2-1, then the total number of
pairs is N^{2}. Similarly, the number of pairs with both members in column 1 is
ct_{1}^{2}, where ct_{1} is column total 1. By extension,
the total number of pairs with both members in the same column is SUM(ct^{2}),
where the summation is across columns. Therefore the number of pairs in different
columns is N^{2} - SUM(ct^{2}).
This value corrects for the fact that we counted each case paired with itself as a
pair, because such pairs are first counted in N^{2} but then subtracted out in SUM(ct^{2}), so they are ultimately not counted.

But this measure does count each pair twice by counting 1-2 and 2-1 as
separate pairs. Ordinarily Con and Dis are defined without this double
counting. Therefore to put the numerator and denominator of *D* in similar
units we should double the numerator. Thus a computing formula for *D* is

*D* = 2(Con - Dis)/(N^{2} - SUM(ct^{2}))

When we apply *D* to the 3 x 2 table of this section, as with gamma we find
Con = 2100 and Dis = 500. The column totals are both 60 and *N* = 120, so
we have N^{2} - SUM(ct^{2}) = 14400 - 2*3600 = 7200.
Therefore *D* = 2(2100 - 500)/7200 = .444. For the collapsed 2 x 2 table
we have Con = 1500 and Dis = 300. The denominator of *D* remains at 7200, so
*D* = 2(1500 - 300)/7200 = .333. Unlike gamma, *D* correctly shows that
a loss of predictive power resulted from collapsing rows 1 and 2 together.

The Somers *D* similarly corrects the limitation of gamma in measuring
the size of a causal relationship. But it is important to place variables in the
proper roles. In prediction problems, the formulas of this section assume the
predictor variable is the row variable and the criterion variable is the column
variable. But for causal problems, the same formulas assume the row variable
is the dependent variable and the column variable is the independent variable.
The earlier section on lambda-max explains
why these rules are reasonable.

For tables with 2 columns, Somers *D* is equivalent to the rank-biserial
correlation, here denoted RBC. RBC can be used to study the difference
between two groups on a ranked variable. Its formula is simple:

RBC = (2/N) (mean rank in group 2 - mean rank in group 1)

Ties are handled in the obvious way--assigning the mean of the tied ranks to any ties. RBC ranges from -1 to 1, reaching these extremes whenever all cases in one group exceed all those in the other. RBC may differ substantially from the more familiar point-biserial correlation, which equals +1 or -1 only if all scores within each group are equal.

In 2 x 2 tables, Somers *D* is equivalent to lambda-max in that
lambda-max = |Somers *D*|. This document reports many equivalencies between
measures, but this is the most remarkable because Somers *D* is derived in
terms of pairs of cases while lambda-max is derived in terms of single cases.
Thus if either measure is used in a 2 x 2 table, it can be explained and justified
in either or both ways.

30 | 20 | 10 |

20 | 30 | 20 |

10 | 20 | 30 |

As before, let the upper left corner be the corner high on both variables. Then a little calculation reveals Con = 5900, Dis = 2300, gamma = .439. If we combine rows 1 and 2, and also combine columns 1 and 2, the table reduces to

100 | 30 |

30 | 30 |

For another limitation of gamma, consider the two 5 x 5 tables below. Again let the upper left corner be the point highest on both row and column variables. In each of the two tables A and B, there are 5 cells with 8 cases each and 20 empty cells. Gamma is 1 in both tables, because neither table has any discordant pairs. But most people would say intuitively that association is higher in table A than in B, because so many pairs in B are tied on either row or column.

8 | 0 | 0 | 0 | 0 |

0 | 8 | 0 | 0 | 0 |

0 | 0 | 8 | 0 | 0 |

0 | 0 | 0 | 8 | 0 |

0 | 0 | 0 | 0 | 8 |

8 | 0 | 8 | 0 | 8 |

0 | 0 | 0 | 0 | 0 |

0 | 0 | 0 | 0 | 8 |

0 | 0 | 0 | 0 | 0 |

0 | 0 | 0 | 0 | 8 |

Both these limitations of gamma are easily fixed; use a statistic whose
numerator is like gamma's, but include in its denominator all pairs not actually
falling in the same cell. By reasoning similar to that used with Somers *D*, the
number of such pairs is *N*^{2} - SUM(*t*^{2}), where
*t* denotes "cell total" and the
summation is across all *rc* cells. We'll denote the statistic with this
denominator as SAG for "symmetrically adjusted gamma". As for Somers *D*
we must multiply the numerator by 2 to correct for double counting in the
denominator. Thus we define

SAG = 2(Con - Dis)/(*N*^{2} - SUM(*t*^{2}))

where Con and Dis are computed without double counting of pairs.

When SAG is applied to the 3 x 3 table of this section, we have *N* =
190, SUM(*t*^{2}) = 4400. As before we have Con = 5900 and Dis = 2300, so SAG
= 2(5900 - 2300)/(1902 - 4400) = .227. In the collapsed 2 x 2 table we have
Con = 3000, Dis = 900, *N* = 190, SUM(*t*^{2}) = 12700, SAG = .179. As
expected, SAG shows that combining rows and columns lowers the association.

When SAG is applied to the two 5 x 5 tables just given, the denominator for either table is 402 - 5 x 82 = 1280. For table A it turns out that Con = 640, so SAG = 2 x 640 / 1280 = 1. But for table B, Con = 162 = 256, so SAG = 2 x 256 / 1280 = .4. Thus SAG corresponds to intuition by yielding a substantially lower value for table B than for A.

One could of course define a statistic like SAG whose denominator consists of all pairs, not merely all pairs in different cells. However, such a statistic could never attain a value of 1 so long as any cell contained more than one case--a property that defies our intuitive meaning of "perfect association" for problems of this sort.

As mentioned earlier, gamma, Somers *D*, and SAG all have ratio-scale
utility interpretations in which you win $1 for every concordant pair, lose $1
for every discordant pair, and win $0 for every other pair. Then all these
measures equal the mean number of dollars won across a specified set of pairs.
For gamma the set is all concordant or discordant pairs, for Somers *D* the set
is all pairs in different columns, and for SAG the set is all pairs in different
cells. Thus the three measures always have the same sign, and |gamma| >=
|Somers D| >= |SAG|.