% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/assoc.R
\name{lambda_gk}
\alias{lambda_gk}
\title{Goodman-Kruskal's Lambda}
\usage{
lambda_gk(
  x,
  direction = c("symmetric", "row", "column"),
  detail = FALSE,
  conf_level = 0.95,
  digits = 3L,
  .include_se = FALSE
)
}
\arguments{
\item{x}{A contingency table (of class \code{table}).}

\item{direction}{Direction of prediction:
\code{"symmetric"} (default), \code{"row"} (column predicts row),
or \code{"column"} (row predicts column).}

\item{detail}{Logical. If \code{FALSE} (default), return the estimate
as a numeric scalar. If \code{TRUE}, return a named numeric vector
including confidence interval and p-value.}

\item{conf_level}{A number between 0 and 1 giving the confidence
level (default \code{0.95}). Only used when \code{detail = TRUE}. Set
to \code{NULL} to omit the confidence interval.}

\item{digits}{Number of decimal places used when printing the
result (default \code{3}). Only affects the \code{detail = TRUE} output.}

\item{.include_se}{Internal parameter; do not use.}
}
\value{
Same structure as \code{\link[=cramer_v]{cramer_v()}}: a scalar when
\code{detail = FALSE}, a named vector when \code{detail = TRUE}.
The p-value tests H0: lambda = 0 (Wald z-test).
}
\description{
\code{lambda_gk()} computes Goodman-Kruskal's Lambda, a proportional
reduction in error (PRE) measure for nominal variables.
}
\details{
Lambda measures how much prediction error is reduced when
the independent variable is used to predict the dependent
variable. It ranges from 0 (no reduction) to 1 (perfect
prediction). Lambda can equal zero even when variables
are associated if the modal category dominates in every
column (or row).
Standard error formulas follow the DescTools implementations
(Signorell et al., 2024); see \code{\link[=cramer_v]{cramer_v()}} for full references.
}
\examples{
tab <- table(sochealth$smoking, sochealth$education)
lambda_gk(tab)
lambda_gk(tab, direction = "row")
lambda_gk(tab, direction = "column", detail = TRUE)

}
\seealso{
\code{\link[=goodman_kruskal_tau]{goodman_kruskal_tau()}}, \code{\link[=uncertainty_coef]{uncertainty_coef()}},
\code{\link[=assoc_measures]{assoc_measures()}}
}
