gk_gamma_vec: Goodman-Kruskal Gamma from Two Vectors (No table() Overhead)

View source: R/gk_gamma_helpers.R

gk_gamma_vecR Documentation

Goodman-Kruskal Gamma from Two Vectors (No table() Overhead)

Description

Computes the Goodman-Kruskal gamma coefficient directly from two numeric vectors, bypassing table() for speed. Uses manual tabulation with integer indexing and cumulative sums for efficient concordant/discordant pair counting.

Usage

gk_gamma_vec(x, y)

Arguments

x

Integer or numeric vector (e.g., item scores).

y

Integer or numeric vector of the same length (e.g., rest scores).

Value

A scalar: the gamma coefficient in [-1, 1], or NA_real_ if the table has fewer than 2 rows or 2 columns.

References

Goodman, L. A. & Kruskal, W. H. (1954). Measures of association for cross classifications. Journal of the American Statistical Association, 49(268), 732–764.


easyRaschBayes documentation built on March 28, 2026, 5:07 p.m.