gkGamma | R Documentation |
Goodman and Kruskal introduce a second coefficient, gamma
(gkGamma
) as a measure of association for two ordered
categorical variables which do not necessarily have the same number of
states. Thus it is useful as a measure of association between an
observed variable and a latent proficiency variable.
gkGamma(tab)
tab |
A matrix whose rows and columns represent rating two different classifications and whose cells represent observed (or expected) counts. |
Let A
and B
be ordinal variables (both oriented in the
same direction either high to low or low to high). Then tab
is
a cross-tabulation of the two variables (e.g., what is produced by
the table
funciton). In the case that one of the
variables is a classification by a Bayesian network, this could also
be an expected tabulation. It also could be normalized by dividing by
the total to give probabilities.
Let (a,b)
and (a',b')
be two randomly chosen data points.
Classify this pair according to the following rule:
If both relationships point the same way,
that is either both a>a`
and b>b'
or
both a<a`
and b<b'
, then the relationship is
concordant.
If both relationships point in
opposite ways,
that is either both a>a`
and b<b'
or
both a<a`
and b>b'
, then the relationship is
discordant.
If both relationships point in
opposite ways,
that is either both a>a`
and b<b'
or
both a<a`
and b>b'
, then the relationship is
discordant.
If one or both variables are the same,
that is either a = a`
or b =b'
or
both, then the relationship is tied.
Let \Pi_s
be the proportion of pairs which are concordant,
\Pi_d
be the proportion of pairs which are discordant, and
\Pi_t
be the proportion of pairs which are tied. Then gamma is
defined as the proportion of concordant pairs minus the proportion of
discordant pairs normalized by the number of non-tied pairs, that is:
\gamma = \frac{\Pi_s - \Pi_d}{1-\Pi_i}
Like a correlation coefficient it runs from -1 (perfect negative
associations) through 0 (no association) to +1 (perfect association).
It is comparable to Kendall's tau (see
cor(,method="kendall")
).
A numeric scalar.
Like a correlation coefficient it runs from -1 (perfect negative
associations) through 0 (no association) to +1 (perfect association).
It is comparable to Kendall's tau (see
cor(,method="kendall")
).
Russell Almond
Goodman, Leo A., Kruskal, William H. (1954). Measures of Association for Cross Classifications. Journal of the American Statistical Association. 49 (268), 732–764.
Other similar statistics (useful for square tables):
fcKappa
, gkLambda
Other measures of correlation: cor
.
Building contingency tables: table
.
## Example from Goodman and Kruskall (1963)
nab <- matrix(c(8,0,0,5,8,4,3,1,14,3,0,4),3,4)
stopifnot(all.equal(.6122,gkGamma(nab),tolerance=.0001))
## Using built-in data set US Judges, rounding to produce ordered
## categories.
table(round(USJudgeRatings[,1:2]))
gkGamma(table(round(USJudgeRatings[,1:2])))
## Kendall's Tau for comparison
cor(round(USJudgeRatings[,1:2]),method="kendall")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.