Returns the top subgroup(s) and recommended treatment flags.
Usage
sg_consistency_out(
df,
result_new,
sg_focus,
index.Z,
names.Z,
details = FALSE,
plot.sg = FALSE,
by.risk = 12,
confs_labels,
is_glm = FALSE,
selection_rule = "neighborhood",
effect_neighborhood = 0.1,
effect_log_scale = FALSE
)Arguments
- df
Data.frame. Original analysis data.
- result_new
Data.table. Sorted subgroup results.
- sg_focus
Character. Sorting focus criterion.
- index.Z
Matrix. Subgroup factor indicators.
- names.Z
Character vector. Factor column names.
- details
Logical. Print details.
- plot.sg
Logical. Plot subgroup curves.
- by.risk
Numeric. Risk interval for plotting.
- confs_labels
Character vector. Human-readable labels.
- is_glm
Logical. If
TRUE, suppresses Kaplan-Meier survival plots (which are not meaningful for GLM outcomes). DefaultFALSE.- selection_rule
Character. Rule defining the candidate inclusion set for
"hrMaxSG"/"hrMinSG". Seesort_subgroups. Default"neighborhood".- effect_neighborhood
Numeric in
[0, 1). Relative tolerance for"hrMaxSG"/"hrMinSG"selection. Seesort_subgroups. Default0.10.- effect_log_scale
Logical. If
TRUE, thehrcolumn stores log-scale values and is exponentiated for the neighborhood test and for Pareto-frontier dominance. DefaultFALSE.
Value
List with elements:
- result
Sorted candidate table (top row = selected subgroup).
- pareto_frontier
Data.table of non-dominated candidates on (effect, N), both maximized. See
compute_pareto_frontier. May beNULLif computation failed.- sg.harm
Factor-level cut names defining the selected subgroup.
- sg.harm_label
Human-readable subgroup labels.
- df_flag
Per-subject treatment-recommendation flags.
- sg.harm.id
Per-subject subgroup-membership indicator.
Examples
if (FALSE) { # \dontrun{
# sg_consistency_out is called internally by forestsearch().
# See forestsearch() for the standard 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")
fs$grp.consistency$out_sg
} # }