View source: R/subgroup_search.R
| subgroup.search | R Documentation |
Searches for subgroups with treatment effect heterogeneity using combinations of candidate factors. Evaluates subgroups for minimum prevalence, event counts, and hazard ratio threshold. Parallelizes the main search loop.
subgroup.search(
Y,
Event,
Treat,
ID = NULL,
Z,
n.min = 30,
d0.min = 15,
d1.min = 15,
hr.threshold = 1,
max.minutes = 30,
minp = 0.05,
rmin = 5,
details = FALSE,
maxk = 2,
parallel_workers = parallel::detectCores(),
estimator_fn = NULL,
df_analysis = NULL,
effect_threshold = NULL,
effect_measure = NULL,
outcome_type = NULL,
adjust_covariates = NULL,
disable_effect_floor = FALSE
)
Y |
Numeric vector of outcome (e.g., time-to-event). |
Event |
Numeric vector of event indicators (0/1). |
Treat |
Numeric vector of treatment group indicators (0/1). |
ID |
Optional vector of subject IDs. |
Z |
Matrix or data frame of candidate subgroup factors (binary indicators). |
n.min |
Integer. Minimum subgroup size. |
d0.min |
Integer. Minimum per-arm filter. For survival and binary
outcomes: minimum number of events in the control arm within the
candidate subgroup. Ignored for continuous outcomes (only
|
d1.min |
Integer. Same as |
hr.threshold |
Numeric. |
max.minutes |
Deprecated (0.4.0.9000): accepted and
ignored. It was documented as a wall-clock budget for the
combination search but was never enforced in the parallel search
path. Passing it emits one warning. Search scope is governed by
|
minp |
Numeric. Minimum prevalence rate for each factor. |
rmin |
Integer. Minimum required reduction in sample size when adding a factor. |
details |
Logical. Print details during execution. |
maxk |
Integer. Maximum number of factors in a subgroup. |
parallel_workers |
Integer. Number of parallel workers (default: all available cores). |
estimator_fn |
Closure or |
df_analysis |
Data frame or |
effect_threshold |
Numeric or |
effect_measure |
Character or |
outcome_type |
Character 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 |
disable_effect_floor |
Logical. When |
List with found subgroups, maximum HR, search time, configuration info, and filtering statistics.
## Not run:
library(survival)
df <- survival::gbsg
df$grade3 <- as.integer(df$grade == "3")
Z <- df[, c("age", "meno", "size", "grade3", "nodes", "pgr", "er")]
res <- subgroup.search(Y = df$rfstime, Event = df$status,
Treat = df$hormon, Z = Z,
hr.threshold = 1.25)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.