DescTools (version 0.99.13)

ConDisPairs: Concordant and Discordant Pairs

Description

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.htm http://support.sas.com/onlinedoc/913/getDoc/en/statug.hlp/freq_sect20.htm

See Also

Association measures: GoodmanKruskalTauA (tau-a), cor (method="kendall") for tau-b, StuartTauC (tau-c), SomersDelta Lambda, UncertCoef, MutInf

Examples

Run this code
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 DataCamp Workspace