# Ordinal trends and finding concordant and discordant pairs

A pair is concordant if the subject ranked higher on X also ranks higher on Y. The pair is discordant if the subject ranking higher on X ranks lower on Y. The pair is tied if the subjects have the same classification on X and/or Y.

Say I have a table (e.g., $n_{11}$ is the first cell: $i=1$, $j=1$)

\begin{array}{rrrr} 1 &3 &10 &6 \\ 2 &3 &10 &7 \\ 1 &6 &14 &12 \\ 0 &1 &9 &11 \end{array}

Can you help me to understand how to select the concordant and discordant pairs?

Here's my understanding for concordant:
First we select $n_{11}$, then $n_{22}$ is $3$ which is greater than $1$, (higher $Y$ and higher $X$). So we have $1(3+10+7+6+14+12+1+9+11)$, is that right? Then how about $n_{13}$? For $n_{13}$, we have $7$ ($n_{24}$) which is less than $n_{13}$ (lower $Y$). So we don't count this pair right?

I am confused about discordant, how could you select the discordant pairs?

• I feel this question is more algorithmic than statistical. Of course it is possible to compute number of concordats and discordants from a frequency table; software computing Gamma or Kendall correlation do just this. (Once I wrote a code doing this in SPSS software.) Mar 7, 2013 at 16:44

Here's how you'd normally set these things out:

Original table of counts:

                        Column variable
1        2         3         4

Row    1        1        3        10         6
variable 2        2        3        10         7
3        1        6        14        12
4        0        1         9        11


(though the row and column variables would normally have more specific names

An observation in cell $(i,j)$ is concordant with an observation in cell $(i',j')$ if $(i'-i)(j'-j) > 0$, and discordant if $(i'-i)(j'-j) < 0$; if that product is exactly 0, it's neither concordant nor discordant.

That is, if both the row and column index move in the same direction - both increase or both decrease, then the pair is concordant. If they move in opposite directions - one increases while the other decreases - then the pair is discordant.

[Aside: To clarify, since the explicit statement above about how to compute it wasn't sufficient - only the relative cell positions matter for whether a pair of cells is 'concordant' or 'discordant'. The counts in the cells are used to work out how much to add to the count. Your table is actually a summary table of the original data.

So your original data would look something like this:

  rowvar colvar
1      1      3
2      3      3
3      4      3
4      3      1
5      3      2
6      3      4
.
.
.
91      2      2
92      1      3
93      3      3
94      3      2
95      2      3
96      3      4


... and what you're doing is computing how many pairs of rows in that long set of data have the row and column vars increase together or decrease together to get a concordant pair (the counts don't appear in this at all - but you get them implicitly when you take all 96 $\times$ 95/2 pairs), or how many pairs have the row and column index moving in opposite directions for a discordant pair. See this definition. But since that's not very compact, it makes sense to write it as a table of counts:

> table(mydata)
colvar
rowvar  1  2  3  4
1  1  3 10  6
2  2  3 10  7
3  1  6 14 12
4  0  1  9 11


Nevertheless, keep in mind your actual data is like that long list, and you have 4560 pairs of rows, each of which is one of concordant, discordant or neither. You're just working it out in a faster way by doing it in a table.

End of aside]

So for example, observations in cell $(2,2)$ are concordant with observations in $(1,1)$, and also $(3,3)$, $(3,4)$, $(4,3)$ and $(4,4)$, and discordant with $(3,1)$, $(4,1)$, $(1,3)$, $(1,4)$. The count for each is the product of the counts in each cell, so when looking at $(2,1)$ vs $(3,2)$ you add 2 x 6 = 12 concordant pairs.

Here I've marked the cells that are discordant with $(2,2)$ in red and the ones that are concordant in blue:

However, when counting you need to avoid counting the pairs twice (we don't "double count") - so you would look only at those cells above (lower-numbered rows) to add to the counts, because the ones in the higher numbered rows will get counted when they are the 'current' cell (the one circled in brown is the current cell we're counting):

Here we only add the cells marked in solid outline to the counts - the ones with the thin, dashed lines will be counted when we make their cells the 'current' cell.

You start with cell $(2,2)$ as the current cell and then progress to higher column and row numbers (only), working your way through the table to the right and down. Hopefully it's all clear now.

• hi, i have another doubt. hope you don't mind. What if (4,4) has a value of "1". Now its smaller than (2,2). So now only (3,3), (3,4) and (4,3) is concordant with (2,2) ? so its 3 * (14+12+9) ? or is it still 3*(14+12+9+1) ? thanks Mar 8, 2013 at 0:49
• Only the relative cell positions matter for concordant or discordant. The counts in the cells are used to work out how much to add to the count. Your table is actually a summary table of the original data. I will edit. Mar 8, 2013 at 0:52
• You might like to recheck how the concordance and discordance of the pairs were defined in terms of $i$ and $j$ - the index of row and column, and not in terms of the count. The count comes into working out how many such pairs you have. Mar 8, 2013 at 1:08