Creates a GBSG-based data generating mechanism that is fully compatible with
simulate_from_dgm. This is the replacement for
create_gbsg_dgm(): it accepts exactly the same arguments and produces
the same numeric output, but returns an object of class
"aft_dgm_flex" instead of "gbsg_dgm".
setup_gbsg_dgm(
model = c("alt", "null"),
k_treat = 1,
k_inter = 1,
k_z3 = 1,
z1_quantile = 0.25,
n_super = 5000L,
cens_type = c("weibull", "uniform"),
use_rand_params = FALSE,
seed = 8316951L,
verbose = FALSE
)An object of class c("aft_dgm_flex", "gbsg_dgm", "list")
with all fields from create_gbsg_dgm() plus:
df_superSuper-population data frame with
simulate_from_dgm()-compatible column names.
model_params$tauCopy of model_params$sigma.
model_params$censoringSub-list with
type, mu, tau for the censoring model.
Character. Either "alt" for alternative hypothesis with heterogeneous treatment effects, or "null" for uniform treatment effect. Default: "alt"
Numeric. Treatment effect multiplier applied to the treatment coefficient from the fitted AFT model. Values > 1 strengthen the treatment effect. Default: 1
Numeric. Interaction effect multiplier for the treatment-subgroup interaction (z1 * z3). Only used when model = "alt". Higher values create more heterogeneity between HR(H) and HR(Hc). Default: 1
Numeric. Effect multiplier for the z3 (menopausal status) coefficient. Default: 1
Numeric. Quantile threshold for z1 (estrogen receptor). Observations with ER <= quantile are coded as z1 = 1. Default: 0.25
Integer. Size of super-population for empirical HR estimation. Default: 5000
Character. Censoring distribution type: "weibull" or "uniform". Default: "weibull"
Logical. If TRUE, modifies confounder coefficients using estimates from randomized subset (meno == 0). Default: FALSE
Integer. Random seed for super-population generation. Default: 8316951
Logical. Print diagnostic information. Default: FALSE
Internally the function calls create_gbsg_dgm() and then:
Adds a df_super field with column names aligned to
simulate_from_dgm() conventions
(lin_pred_1, lin_pred_0, lin_pred_cens_1,
lin_pred_cens_0, flag_harm).
Adds a model_params$tau field (= model_params$sigma)
and a model_params$censoring sub-list.
Sets class to c("aft_dgm_flex", "gbsg_dgm", "list").
The original df_super_rand field is kept so that
compute_dgm_cde() and print.gbsg_dgm continue to work.
create_gbsg_dgm, simulate_from_dgm,
compute_dgm_cde
# \donttest{
dgm <- setup_gbsg_dgm(model = "alt", k_inter = 2, verbose = FALSE)
dgm <- compute_dgm_cde(dgm)
print(dgm)
sim <- simulate_from_dgm(dgm, n = 400, seed = 1)
# }
Run the code above in your browser using DataLab