kendall_tau_b() computes Kendall's Tau-b for a two-way
contingency table of ordinal variables.
kendall_tau_b(
x,
detail = FALSE,
conf_level = 0.95,
digits = 3L,
.include_se = FALSE
)Same structure as cramer_v(): a scalar when
detail = FALSE, a named vector when detail = TRUE.
The p-value tests H0: tau-b = 0 (Wald z-test).
A contingency table (of class table).
Logical. If FALSE (default), return the estimate
as a numeric scalar. If TRUE, return a named numeric vector
including confidence interval and p-value.
A number between 0 and 1 giving the confidence
level (default 0.95). Only used when detail = TRUE. Set
to NULL to omit the confidence interval.
Number of decimal places used when printing the
result (default 3). Only affects the detail = TRUE output.
Internal parameter; do not use.
Kendall's Tau-b is computed as
\(\tau_b = (C - D) / \sqrt{(n_0 - n_1)(n_0 - n_2)}\),
where \(n_0 = n(n-1)/2\), \(n_1\) is the number of
pairs tied on the row variable, and \(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 cramer_v() for full references.
kendall_tau_c(), gamma_gk(), somers_d(),
assoc_measures()
Other association measures:
assoc_measures(),
contingency_coef(),
cramer_v(),
gamma_gk(),
goodman_kruskal_tau(),
kendall_tau_c(),
lambda_gk(),
phi(),
somers_d(),
uncertainty_coef(),
yule_q()
tab <- table(sochealth$education, sochealth$self_rated_health)
kendall_tau_b(tab)
Run the code above in your browser using DataLab