Creates violin plots with embedded boxplots showing the distribution of hazard ratio estimates across simulations for different analysis populations. Supports symmetric trimming to handle extreme values that can distort the display when small subgroups produce very large HR estimates.
SGplot_estimates(
df,
label_training = "Training",
label_testing = "Testing",
label_itt = "ITT (stratified)",
label_sg = "Testing (subgroup)",
trim_fraction = NULL,
ylim = NULL,
show_summary = NULL,
title = "Distribution of HR Estimates Across Simulations",
subtitle = NULL
)List with components:
data.table formatted for plotting, with a
trimmed logical column when trimming is active
ggplot2 object
List of per-group trimming diagnostics (NULL when
no trimming). Each element contains: n_total, n_trimmed,
n_flagged, raw_mean, raw_sd, trimmed_mean,
trimmed_sd, lower_bound, upper_bound.
data.frame or data.table. Simulation results from
mrct_region_sims
Character. Label for training data estimates. Default: "Training"
Character. Label for testing data estimates. Default: "Testing"
Character. Label for ITT estimates. Default: "ITT (stratified)"
Character. Label for subgroup estimates. Default: "Testing (subgroup)"
Numeric or NULL. Fraction of observations to trim from each tail (e.g., 0.01 trims the lowest 1\ When non-NULL, trimmed means and SDs are computed for each group, extreme observations are flagged, and the y-axis is clipped to the trimmed data range. Set to NULL (default) for no trimming (backward compatible).
Numeric vector of length 2 or NULL. Explicit y-axis limits
as c(lower, upper). Overrides automatic limits from trimming.
Default: NULL (auto).
Logical. Annotate each violin with mean (SD) below
the x-axis labels. When trimming is active, displays trimmed
statistics. Default: TRUE when trim_fraction is non-NULL,
FALSE otherwise.
Character. Plot title. Default: "Distribution of HR Estimates Across Simulations".
Character or NULL. Plot subtitle. When trimming is active and subtitle is NULL, an auto-generated note indicating the trim fraction and number of flagged observations is shown. Default: NULL.
mrct_region_sims for generating simulation results,
summaryout_mrct for tabular summaries with trimming