User:Elmiguel409/Goodman-Kruskal gamma

In descriptive statistics, an index of association between two variables measured on ordinal scales. It is closely related to Somers' D and to Kendall's tau. The Gamma statistic is preferable to Spearman R or Kendall tau when the data contain many tied observations. In terms of the underlying assumptions, Gamma is equivalent to Spearman R or Kendall tau; in terms of its interpretation and computation, it is more similar to Kendall tau than Spearman R. In short, Gamma is also a probability; specifically, it is computed as the difference between the probability that the rank ordering of the two variables agree minus the probability that they disagree, divided by 1 minus the probability of ties. Thus, Gamma is basically equivalent to Kendall tau, except that ties are explicitly taken into account.

Equation
If two pairs of scores are examined, they must either be concordant, in the sense that the one ranked higher than the other on the first variable is also ranked higher than the other on the second variable, or discordant. Gamma is defined as the difference between the number of concordant pairs and the number of discordant pairs divided by the total number of concordant and discordant pairs, and it ranges from 0 to 1.