Run Single Consistency Split
Source:R/subgroup_consistency_helpers.R
run_single_consistency_split.RdPerforms one random 50/50 split and evaluates whether both halves meet the HR consistency threshold.
Usage
run_single_consistency_split(
df.x,
N.x,
hr.consistency,
cox_init = 0,
estimator_fn = NULL,
consistency_threshold = NULL,
adjust_covariates = NULL
)Arguments
- df.x
data.table. Subgroup data with columns Y, Event, Treat.
- N.x
Integer. Number of observations in subgroup.
- hr.consistency
Numeric.
c2, an effect threshold – the minimum effect required in each half of a split for that split to count as consistent. Not a proportion and not the consistency rate.forestsearch()calls thisconsistency.threshold/hr.consistency.- cox_init
Numeric. Initial value for Cox model (log HR).
- estimator_fn
Closure or
NULL. Effect-estimator closure frommake_effect_estimatorfor GLM outcomes. DefaultNULL(uses Cox model).- consistency_threshold
Numeric or
NULL. Threshold for GLM consistency evaluation. DefaultNULL(useshr.consistency).- adjust_covariates
This option is implemented but has not been tested against the manuscript analyses or the simulation studies of León and Anderson (2026a, 2026b), which use the unadjusted treatment-only fits. Character vector or
NULL. Additional Cox model terms (e.g."strata(x1)") passed toget_split_hr_faston the survival path. Ignored on the GLM path. DefaultNULL(unadjusted).
Examples
# \donttest{
library(data.table)
set.seed(1)
df <- data.table(
Y = rexp(100),
Event = rbinom(100, 1, 0.55),
Treat = rep(0:1, 50)
)
run_single_consistency_split(df, N.x = 100, hr.consistency = 1.0)
#> [1] 1
# }