Creates a formatted gt table from simulation operating characteristics results.
Usage
format_oc_results(
results,
analyses = NULL,
metrics = "all",
digits = 3,
digits_hr = 3,
title = "Operating Characteristics Summary",
subtitle = NULL,
use_gt = TRUE,
effect_measure = NULL,
dgm = NULL,
subgroup_notation = c("harm", "benefit")
)Arguments
- results
data.table or data.frame. Simulation results from
run_simulation_analysisor combined results from multiple simulations.- analyses
Character vector. Analysis methods to include. Default: NULL (all analyses in results)
- metrics
Character vector. Metrics to display. Options include: "detection", "classification", "hr_estimates", "ahr_estimates", "cde_estimates", "subgroup_size", "all". Default: "all"
- digits
Integer. Decimal places for proportions. Default: 3
- digits_hr
Integer. Decimal places for hazard ratios. Default: 3
- title
Character. Table title. Default: "Operating Characteristics Summary"
- subtitle
Character or
NULL. Table subtitle. WhenNULL(default) and adgmis provided, an informative subtitle is auto-generated showing the number of simulations and true effect sizes using notation-aware labels (e.g.,"100 sims, OR(H) = 2.00, OR(Hc) = 0.65").- use_gt
Logical. Return gt table if TRUE, data.frame if FALSE. Default: TRUE
- effect_measure
Character or
NULL. The effect measure used in the simulation (e.g.,"HR","OR","MD"). When provided, identity-scale measures (MD, RD, IRD) are negated rather than reciprocated during benefit-search inversion. WhenNULL(default), auto-detected fromdgm$effect_measureifdgmis provided; otherwise ratio-scale inversion (1/x) is used for backward compatibility.- dgm
Optional DGM object (
gbsg_dgm,aft_dgm_flex, orglm_dgm). When provided,effect_measureis auto-detected fromdgm$effect_measure(unless explicitly overridden) and column spanner labels adapt to the outcome type.- subgroup_notation
Character.
"harm"(default) labels subgroups as H/Hc;"benefit"labels as G/Gc for benefit-search analyses (treatment switching).
Details
The function summarizes simulation results across multiple metrics:
Found: Proportion of simulations finding a subgroup (any.H)
Classification: Sen, spec, PPV, NPV
HR Estimates: Mean Cox hazard ratios in true (H) and identified (H-hat) subgroups and their complements
AHR Estimates: Mean average hazard ratios (from loghr_po) in true and identified subgroups
CDE Estimates: Controlled direct effects (from theta_0/theta_1) in true and identified subgroups
Subgroup Size: Average, min, max sizes
Column notation aligns with build_estimation_table and
Leon et al. (2024): H = true (oracle) subgroup, H-hat =
identified subgroup. The asterisk (*) is reserved for bootstrap
bias-corrected estimates and is not used in this summary table.