Skip to contents

Constructs a publication-quality gt table summarizing subgroup identification and classification rates across one or more data generation scenarios and analysis methods. The layout mirrors Table 4 of Leon et al. (2024) with metrics grouped by model scenario (null / alt) and columns for each analysis method.

Usage

build_classification_table(
  scenario_results,
  analyses = NULL,
  digits = 2,
  title = "Subgroup Identification and Classification Rates",
  n_sims = NULL,
  bold_threshold = 0.05,
  font_size = 12
)

Arguments

scenario_results

Named list. Each element is itself a list with:

results

data.table from run_simulation_analysis.

label

Character scenario label, e.g., "M1".

n_sample

Integer sample size.

dgm

DGM object (for true HRs and subgroup prevalence).

hypothesis

Character: "null" or "alt".

analyses

Character vector of analysis labels to include (e.g., c("FS", "FSlg", "GRF")). When NULL, all unique values of results$analysis across scenarios are used.

digits

Integer. Decimal places for proportions. Default: 2.

title

Character. Table title. Default: "Subgroup Identification and Classification Rates".

n_sims

Integer. Number of simulations (for subtitle). Default: NULL.

bold_threshold

Numeric. Type I error threshold above which the any(H) value is shown in bold. Set NULL to disable. Default: 0.05.

font_size

Numeric. Font size in pixels for table text. Default: 12. Increase to 14 or 16 for larger display.

Value

A gt table object.

Details

For each scenario the function computes:

  • any(H): Proportion of simulations identifying any subgroup.

  • sens(H): Mean sensitivity (only under alternative).

  • sens(Hc): Mean specificity.

  • ppv(H): Mean positive predictive value (only under alternative).

  • ppv(Hc): Mean negative predictive value.

  • avg|H|: Mean size of identified subgroup (when found).

Under the null hypothesis the rows are reduced to any(H), sens(Hc), ppv(Hc), and avg|H|.

Examples

if (FALSE) { # \dontrun{
# Assemble results from H0 and H1 simulations
scenarios <- list(
  null = list(
    results = results_null, label = "M1",
    n_sample = 700, dgm = dgm_null, hypothesis = "null"
  ),
  alt = list(
    results = results_alt, label = "M1",
    n_sample = 700, dgm = dgm_calibrated, hypothesis = "alt"
  )
)

build_classification_table(scenarios, n_sims = 100)
} # }