View source: R/subgroup_consistency_helpers.R
| evaluate_subgroup_consistency | R Documentation |
Evaluates a single candidate subgroup for treatment-effect consistency using
repeated random data splits (the standard, non-two-stage algorithm). For
each split the subgroup effect is scored and compared against the harm
threshold; the consistency rate is the proportion of splits meeting it.
Called internally by forestsearch (via
subgroup.consistency); evaluate_consistency_twostage
is the screened, early-stopping counterpart used when
use_twostage = TRUE.
evaluate_subgroup_consistency(
m,
index.Z,
names.Z,
df,
found.hrs,
n.splits,
hr.consistency,
pconsistency.threshold,
pconsistency.digits = 2,
maxk,
confs_labels,
details = FALSE,
estimator_fn = NULL,
consistency_threshold = NULL,
adjust_covariates = NULL,
consistency_method = "split",
glm_resample_spec = NULL,
skip_consistency = FALSE
)
m |
Integer. Index of subgroup to evaluate. |
index.Z |
data.table or matrix. Factor indicators for all subgroups. |
names.Z |
Character vector. Names of factor columns. |
df |
data.frame. Original data with Y, Event, Treat, id columns. |
found.hrs |
data.table. Subgroup hazard ratio results. |
n.splits |
Integer. Number of random splits used to evaluate consistency. |
hr.consistency |
Numeric. |
pconsistency.threshold |
Numeric. |
pconsistency.digits |
Integer. Number of decimal places to which the
consistency proportion is rounded before it is compared with
|
maxk |
Integer. Maximum number of factors in a subgroup. |
confs_labels |
Character vector. Labels for confounders. |
details |
Logical. Print progress details. |
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 |
consistency_method |
Character. |
glm_resample_spec |
List or |
skip_consistency |
Logical. When |
Named numeric vector with consistency results, or NULL if the
subgroup does not meet the criteria.
## Not run:
# evaluate_subgroup_consistency() is called internally by forestsearch().
# Use forestsearch() as the entry point:
gbsg <- survival::gbsg
gbsg$grade3 <- as.integer(gbsg$grade == 3)
fs <- forestsearch(gbsg, id.name = "pid",
confounders.name = c("age", "meno", "size", "grade3", "nodes", "pgr", "er"),
outcome.name = "rfstime", treat.name = "hormon", event.name = "status")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.