% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/gk_gamma_helpers.R
\name{gk_gamma}
\alias{gk_gamma}
\title{Goodman-Kruskal Gamma from a Contingency Table}
\usage{
gk_gamma(tab)
}
\arguments{
\item{tab}{A matrix or table representing a contingency table with
rows and columns in ordinal order.}
}
\value{
A scalar: the gamma coefficient in \eqn{[-1, 1]}.
}
\description{
Computes the Goodman-Kruskal gamma coefficient for an ordinal
contingency table. This is an internal helper function.
}
\details{
Gamma is defined as \eqn{(C - D) / (C + D)}, where \eqn{C} is the
number of concordant pairs and \eqn{D} is the number of discordant
pairs. Uses cumulative suffix sums for \eqn{O(nr \times nc)}
complexity.
}
\references{
Goodman, L. A. & Kruskal, W. H. (1954). Measures of association for
cross classifications. \emph{Journal of the American Statistical
Association}, \emph{49}(268), 732--764.
}
\keyword{internal}
