Identifies subgroups with differential treatment effect using generalized random forests (GRF) and policy trees. This function uses causal survival forests to identify heterogeneous treatment effects and policy trees to create interpretable subgroup definitions.
grf.subg.harm.survival(
data,
confounders.name,
outcome.name,
event.name,
id.name,
treat.name,
frac.tau = 1,
n.min = 60,
dmin.grf = 0,
RCT = TRUE,
details = FALSE,
sg.criterion = "mDiff",
maxdepth = 2,
seedit = 8316951,
return_selected_cuts_only = FALSE
)A list with GRF results, including:
Original data with added treatment recommendation flags
Selected subgroup information
Expression defining the identified subgroup
Cut expressions - either all cuts from all trees (if
return_selected_cuts_only = FALSE) or only cuts from the selected tree
depth (if return_selected_cuts_only = TRUE)
Unique variable names used in cuts
Selected policy tree object
Time horizon used for RMST
All subgroups with positive treatment effect difference
Depth of the tree that identified the subgroup (when found)
Logical indicating which cut extraction mode was used
Additional tree-specific cuts and objects (tree1, tree2, tree3) based on maxdepth
Data frame containing the analysis data.
Character vector of confounder variable names.
Character. Name of outcome variable (e.g., time-to-event).
Character. Name of event indicator variable (0/1).
Character. Name of ID variable.
Character. Name of treatment group variable (0/1).
Numeric. Fraction of tau for GRF horizon (default: 1.0).
Integer. Minimum subgroup size (default: 60).
Numeric. Minimum difference in subgroup mean (default: 0.0).
Logical. Is the data from a randomized controlled trial? (default: TRUE)
Logical. Print details during execution (default: FALSE).
Character. Subgroup selection criterion ("mDiff" or "Nsg").
Integer. Maximum tree depth (1, 2, or 3; default: 2).
Integer. Random seed (default: 8316951).
Logical. If TRUE, returns only cuts from the tree
depth that identified the selected subgroup meeting dmin.grf. If FALSE (default),
returns all cuts from all fitted trees (depths 1 through maxdepth).
The return_selected_cuts_only parameter controls which cuts are returned:
Returns all cuts from all fitted trees (depths 1 to
maxdepth). This provides the full set of candidate splits for downstream
exploration and is the original behavior for backward compatibility.
Returns only cuts from the tree at the depth that identified
the "winning" subgroup meeting the dmin.grf criterion. This is useful
when you want a focused set of cuts associated with the selected subgroup,
reducing noise from non-selected trees.
When return_selected_cuts_only = TRUE and no subgroup meets the criteria,
tree.cuts will be empty (character(0)).