View source: R/subgroup_consistency_helpers.R
| run_single_consistency_split | R Documentation |
Performs one random 50/50 split and evaluates whether both halves meet the HR consistency threshold.
run_single_consistency_split(
df.x,
N.x,
hr.consistency,
cox_init = 0,
estimator_fn = NULL,
consistency_threshold = NULL,
adjust_covariates = NULL
)
df.x |
data.table. Subgroup data with columns Y, Event, Treat. |
N.x |
Integer. Number of observations in subgroup. |
hr.consistency |
Numeric. |
cox_init |
Numeric. Initial value for Cox model (log HR). |
estimator_fn |
Closure or |
consistency_threshold |
Numeric or |
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 |
Numeric. 1 if both splits meet threshold, 0 if not, NA if error.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.