View source: R/simulation_tables.R
| build_estimation_table | R Documentation |
Constructs a publication-quality gt table summarizing estimation
properties for hazard ratios in the identified subgroup and its complement.
The layout mirrors Table 5 of Leon et al. (2024), showing average estimate,
empirical SD, min, max, and relative bias for each estimator.
build_estimation_table(
results,
dgm,
analysis_method = "FSlg",
n_boots = NULL,
digits = 2,
title = "Estimation Properties",
subtitle = NULL,
font_size = 12,
cde_H = NULL,
cde_Hc = NULL,
subgroup_notation = c("harm", "benefit"),
trim_threshold = 1000,
trim_fraction = 0.01
)
results |
|
dgm |
DGM object. Used for true parameter values ( |
analysis_method |
Character. Which analysis method to tabulate
(e.g., |
n_boots |
Integer or |
digits |
Integer. Decimal places. Default: 2. |
title |
Character. Table title. |
subtitle |
Character or |
font_size |
Numeric. Font size in pixels for table text. Default: 12. Increase to 14 or 16 for larger display. |
cde_H |
Numeric or |
cde_Hc |
Numeric or |
subgroup_notation |
Character. |
trim_threshold |
Numeric or |
trim_fraction |
Numeric in |
Uses the paper's notation conventions:
theta-dagger: Marginal (causal) HR truth
theta-ddagger: Controlled direct effect (CDE) truth
theta-hat(H-hat): Plugin Cox estimate in identified subgroup
theta-hat*(H-hat): Bootstrap bias-corrected estimate
Includes both Cox-based HR and AHR (Average Hazard Ratio from loghr_po) estimators when AHR columns are present in the results.
For each subgroup (H and Hc) the function reports:
Avg: Mean of the estimates across estimable simulations.
SD: Empirical standard deviation.
Min / Max: Range.
b-dagger: Relative bias (percent) vs marginal truth,
100 * (Avg - theta_dagger) / theta_dagger.
b-ddagger (conditional): Relative bias (percent) vs CDE truth, shown when CDE values are available.
When bootstrap-corrected columns (hr.H.bc, hr.Hc.bc) are
present in results, an additional bias-corrected row
(theta-hat*(H-hat)) is added per subgroup.
When AHR columns (ahr.H.hat, ahr.Hc.hat) are present, AHR
estimation rows are appended using the DGM's true AHR values for relative
bias calculation.
When CDE columns (cde.H.hat, cde.Hc.hat) are present and
CDE truth values are available, CDE estimation rows
(theta-ddagger(H-hat)) are appended. The b-dagger column for CDE rows
reports bias relative to the CDE truth rather than the marginal HR.
A gt table object, or NULL if no estimable
realizations exist.
build_classification_table,
format_oc_results, get_dgm_hr
## Not run:
# Basic usage (marginal truth only)
build_estimation_table(
results = results_alt,
dgm = dgm_calibrated,
analysis_method = "FSlg"
)
# With CDE truth (full Table 5 alignment)
build_estimation_table(
results = results_alt,
dgm = dgm_calibrated,
cde_H = 2.25,
cde_Hc = 0.60
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.