Creates diagnostic plots for subgroup treatment effects from df_super object
plot_subgroup_effects(
df_super,
z,
hrz_crit = 0,
log.hrs = NULL,
ahr_empirical = NULL,
plot_type = c("both", "profile", "ahr"),
add_rug = TRUE,
zpoints_by = 1,
...
)A list containing:
The minimum z value where loghr_po < hrz_crit
Average hazard ratio for optimal subgroup (z >= cut.zero)
Grid of z values used for AHR calculations
AHR for population with z >= zpoints
AHR for population with z <= zpoints
Alternative AHR calculation for z >= zpoints
Alternative AHR calculation for z <= zpoints
A data frame containing subgroup analysis results with columns: loghr_po (log hazard ratios), and optionally theta_1 and theta_0 (treatment-specific parameters)
Character string specifying the column name to use as the subgroup score (e.g., "z_age", "z_size", "subgroup"). Required.
Critical hazard ratio threshold for defining optimal subgroup. Default is 1 (HR=1 on log scale is 0).
Optional vector of reference log hazard ratios to display as horizontal lines. Default is NULL.
Optional empirical average hazard ratio to display. If NULL, calculated from data. Default is NULL.
Character string specifying plot type: "both" (default), "profile", or "ahr".
Logical indicating whether to add rug plot of z values. Default is TRUE.
Step size for z-axis grid when calculating AHR curves. Default is 1.
Additional graphical parameters passed to plot()
The function creates up to two plots:
Treatment effect profile: Shows log hazard ratio as function of z
Average hazard ratio curve: Shows AHR for subgroups z >= threshold
The "optimal" subgroup is defined as patients with z >= cut.zero, where cut.zero is the minimum z value with favorable treatment effect (loghr < hrz_crit).