View source: R/gk_gamma_helpers.R
| gk_gamma | R Documentation |
Computes the Goodman-Kruskal gamma coefficient for an ordinal contingency table. This is an internal helper function.
gk_gamma(tab)
tab |
A matrix or table representing a contingency table with rows and columns in ordinal order. |
Gamma is defined as (C - D) / (C + D), where C is the
number of concordant pairs and D is the number of discordant
pairs. Uses cumulative suffix sums for O(nr \times nc)
complexity.
A scalar: the gamma coefficient in [-1, 1].
Goodman, L. A. & Kruskal, W. H. (1954). Measures of association for cross classifications. Journal of the American Statistical Association, 49(268), 732–764.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.