cox_index: Cox index for a binary covariate

View source: R/baselinr.R

cox_indexR Documentation

Cox index for a binary covariate

Description

Computes the What Works Clearinghouse (WWC) Cox index, a standardized effect size for a binary (dichotomous) covariate. The Cox index places the difference between two proportions on a scale comparable to Hedges' g, so it can be classified with the same baseline-equivalence thresholds.

Usage

cox_index(x, treatment, na.rm = TRUE)

Arguments

x

A binary covariate (numeric 0/1, logical, two-level factor, or any vector with exactly two unique non-missing values). The larger value (e.g. 1, TRUE, or the second sorted level) is treated as the "event".

treatment

Vector the same length as x identifying group membership; exactly two unique non-missing values (see hedges_g()).

na.rm

Logical; drop rows where x or treatment is NA. Default TRUE.

Details

The index is d_{Cox} = (\mathrm{logit}(p_t) - \mathrm{logit}(p_c)) / 1.65, where p_t and p_c are the proportions in the "event" category for the treatment and comparison groups.

Value

A single numeric value: the Cox index. Returns NA (with a warning) when a group proportion is exactly 0 or 1, where the index is undefined.

References

What Works Clearinghouse (2022). Procedures Handbook (Version 5.0). U.S. Department of Education.

Examples

x <- c(1, 1, 1, 1, 0, 1, 0, 0)
g <- c(1, 1, 1, 1, 0, 0, 0, 0)
cox_index(x, g)


baselinr documentation built on July 8, 2026, 9:07 a.m.