% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/assoc.R
\name{kendall_tau_b}
\alias{kendall_tau_b}
\title{Kendall's Tau-b}
\usage{
kendall_tau_b(
  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{
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: tau-b = 0 (Wald z-test).
}
\description{
\code{kendall_tau_b()} computes Kendall's Tau-b for a two-way
contingency table of ordinal variables.
}
\details{
Kendall's Tau-b is computed as
\eqn{\tau_b = (C - D) / \sqrt{(n_0 - n_1)(n_0 - n_2)}},
where \eqn{n_0 = n(n-1)/2}, \eqn{n_1} is the number of
pairs tied on the row variable, and \eqn{n_2} is the number
tied on the column variable. Tau-b corrects for ties and is
appropriate for square tables.
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$education, sochealth$self_rated_health)
kendall_tau_b(tab)

}
\seealso{
\code{\link[=kendall_tau_c]{kendall_tau_c()}}, \code{\link[=gamma_gk]{gamma_gk()}}, \code{\link[=somers_d]{somers_d()}},
\code{\link[=assoc_measures]{assoc_measures()}}
}
