% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/assoc.R
\name{cramer_v}
\alias{cramer_v}
\title{Cramer's V}
\usage{
cramer_v(
  x,
  detail = FALSE,
  conf_level = 0.95,
  digits = 3L,
  .include_se = FALSE
)
}
\arguments{
\item{x}{A contingency table (of class \code{table}).}

\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{
When \code{detail = FALSE}: a single numeric value (the
estimate).
When \code{detail = TRUE} and \code{conf_level} is non-\code{NULL}:
\code{c(estimate, ci_lower, ci_upper, p_value)}.
When \code{detail = TRUE} and \code{conf_level = NULL}:
\code{c(estimate, p_value)}.
The p-value tests the null hypothesis of no association
(Pearson chi-squared test).
}
\description{
\code{cramer_v()} computes Cramer's V for a two-way contingency table,
measuring the strength of association between two categorical variables.
}
\details{
Cramer's V is computed as
\eqn{V = \sqrt{\chi^2 / (n \cdot (k - 1))}}, where \eqn{\chi^2}
is the Pearson chi-squared statistic, \eqn{n} is the total count,
and \eqn{k = \min(r, c)}.
The confidence interval uses the Fisher z-transformation.
Standard error formulas follow the DescTools implementations
(Signorell et al., 2024).
}
\examples{
tab <- table(sochealth$smoking, sochealth$education)
cramer_v(tab)
cramer_v(tab, detail = TRUE)
cramer_v(tab, detail = TRUE, conf_level = NULL)

}
\references{
Agresti, A. (2002). \emph{Categorical Data Analysis} (2nd ed.). Wiley.

Liebetrau, A. M. (1983). \emph{Measures of Association}. Sage.

Signorell, A. et al. (2024). \emph{DescTools: Tools for Descriptive
Statistics}. R package.
}
\seealso{
\code{\link[=phi]{phi()}}, \code{\link[=contingency_coef]{contingency_coef()}}, \code{\link[=assoc_measures]{assoc_measures()}}
}
