
Last chance! 50% off unlimited learning
Sale ends in
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.
ConDisPairs(x)
a 2-dimensional table. The column and the row order must be the logical one.
a list with the number of concordant pairs, the number of discordant pairs and the matrix
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.
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.
Association measures:
KendallTauA
(tau-a), cor
(method="kendall") for tau-b, StuartTauC
(tau-c), SomersDelta
Lambda
, GoodmanKruskalTau
(tau), UncertCoef
, MutInf
# NOT RUN {
tab <- as.table(rbind(c(26,26,23,18,9),c(6,7,9,14,23)))
ConDisPairs(tab)
# }
Run the code above in your browser using DataLab