View source: R/simulate_data.R
| simulate_hybrid_cox | R Documentation |
Generates a randomized trial augmented with an external control arm, under a Cox proportional hazards model
h(t \mid T,Z,X) = h_0(t)\,\exp(\theta T + \delta Z + \beta^\top X),
where T is the treatment indicator, Z is the external-control
indicator, X is a vector of baseline covariates, \theta is
the treatment effect, and \delta is the population drift between
concurrent and external controls.
simulate_hybrid_cox(
nI1 = 150,
nI0 = 150,
nE = 300,
theta0 = 0,
delta0 = 0,
p = 5,
beta = NULL,
rho = 0,
cov_shift = rep(0, p),
shape = 1.2,
lambda = 0.02,
target_cens = 0.2
)
nI1 |
Number of internal randomized treated subjects. |
nI0 |
Number of internal randomized concurrent control subjects. |
nE |
Number of external control subjects. |
theta0 |
True treatment effect (log hazard ratio). |
delta0 |
True population drift (log hazard ratio for external vs. internal controls). |
p |
Number of covariates; use 0 for the no-covariate setting. |
beta |
Numeric vector of covariate coefficients (length |
rho |
Equicorrelation of covariates. |
cov_shift |
Covariate mean shift in the external control arm
(numeric vector of length |
shape |
Weibull shape parameter for event-time generation. |
lambda |
Baseline scale parameter for event-time generation. |
target_cens |
Target right-censoring proportion. |
A list with components:
dataA data frame with time, status,
T, Z, and covariates X1, ..., Xp.
truthThe true parameters used to generate the data.
settingsThe simulation settings, including the calibrated censoring rate.
set.seed(1)
sim <- simulate_hybrid_cox(nI1 = 100, nI0 = 100, nE = 200,
theta0 = log(0.8), delta0 = 0)
head(sim$data)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.