This function counts concordant and discordant pairs for two variables x, y with at least ordinal scale, aggregated in a
2way table. This is the base for many association measures like Goodman Kruskal's gamma, but also all tau measures.
Usage
ConDisPairs(x)
Arguments
x
a 2-dimensional table. The column and the row order must be the logical one.
Value
a list with the number of concordant pairs, the number of discordant pairs and
the matrix
Details
The code is so far implemented in R (O(n^2)) and therefore slow for large sample sizes (>5000).
An O(n log(n)) implementation is on track.
References
Agresti, A. (2002) Categorical Data Analysis. John Wiley & Sons,
pp. 57-59.
Goodman, L. A., & Kruskal, W. H. (1954) Measures of
association for cross classifications. Journal of the
American Statistical Association, 49, 732-764.
Goodman, L. A., & Kruskal, W. H. (1963) Measures of
association for cross classifications III: Approximate
sampling theory. Journal of the American Statistical
Association, 58, 310-364.
http://support.sas.com/onlinedoc/913/getDoc/en/statug.hlp/freq_sect18.htmhttp://support.sas.com/onlinedoc/913/getDoc/en/statug.hlp/freq_sect20.htm