tssim | R Documentation |
Simulates data for studies involving treatment switching, incorporating time-dependent confounding. The generated data can be used to evaluate methods for handling treatment switching in survival analysis.
tssim(
tdxo = 0L,
coxo = 1L,
p_R = 0.5,
p_X_1 = NA_real_,
p_X_0 = NA_real_,
rate_T = NA_real_,
beta1 = NA_real_,
beta2 = NA_real_,
gamma0 = NA_real_,
gamma1 = NA_real_,
gamma2 = NA_real_,
gamma3 = NA_real_,
gamma4 = NA_real_,
zeta0 = NA_real_,
zeta1 = NA_real_,
zeta2 = NA_real_,
zeta3 = NA_real_,
alpha0 = NA_real_,
alpha1 = NA_real_,
alpha2 = NA_real_,
theta1_1 = NA_real_,
theta1_0 = NA_real_,
theta2 = NA_real_,
rate_C = NA_real_,
followup = NA_integer_,
days = NA_integer_,
n = NA_integer_,
NSim = 1000L,
seed = NA_integer_
)
tdxo |
Logical indicator for timing of treatment switching:
|
coxo |
Logical indicator for arm-specific treatment switching:
|
p_R |
Probability of randomization to the experimental arm. |
p_X_1 |
Probability of poor baseline prognosis in the experimental arm. |
p_X_0 |
Probability of poor baseline prognosis in the control arm. |
rate_T |
Baseline hazard rate for time to death. |
beta1 |
Log hazard ratio for randomized treatment ( |
beta2 |
Log hazard ratio for baseline covariate ( |
gamma0 |
Intercept for the time-dependent covariate model ( |
gamma1 |
Coefficient for lagged treatment switching ( |
gamma2 |
Coefficient for lagged |
gamma3 |
Coefficient for baseline covariate ( |
gamma4 |
Coefficient for randomized treatment ( |
zeta0 |
Intercept for the disease progression model ( |
zeta1 |
Coefficient for |
zeta2 |
Coefficient for baseline covariate ( |
zeta3 |
Coefficient for randomized treatment ( |
alpha0 |
Intercept for the treatment switching model ( |
alpha1 |
Coefficient for |
alpha2 |
Coefficient for baseline covariate ( |
theta1_1 |
Negative log time ratio for |
theta1_0 |
Negative log time ratio for |
theta2 |
Negative log time ratio for |
rate_C |
Hazard rate for random (dropout) censoring. |
followup |
Number of treatment cycles per subject. |
days |
Number of days in each treatment cycle. |
n |
Number of subjects per simulation. |
NSim |
Number of simulated datasets. |
seed |
Random seed for reproducibility. |
A list of data frames, each containing simulated longitudinal and event history data with the following variables:
id
: Subject identifier.
trtrand
: Randomized treatment assignment (0 = control,
1 = experimental)
bprog
: Baseline prognosis (0 = good, 1 = poor).
tpoint
: Treatment cycle index.
tstart
: Start day of the treatment cycle.
tstop
: End day of the treatment cycle.
L
: Time-dependent covariate predicting survival and switching;
affected by treatment switching.
Llag
: Lagged value of L
.
Z
: Disease progression status at tstop
.
A
: Treatment switching status at tstop
.
Alag
: Lagged value of A
.
Y
: Death indicator at tstop
.
timeOS
: Observed time to death or censoring.
died
: Indicator of death by end of follow-up.
progressed
: Indicator of disease progression by end of follow-up.
timePD
: Observed time to progression or censoring.
xo
: Indicator for whether treatment switching occurred.
xotime
: Time of treatment switching (if applicable).
censor_time
: Administrative censoring time.
Kaifeng Lu, kaifenglu@gmail.com
Jessica G. Young, and Eric J. Tchetgen Tchetgen. Simulation from a known Cox MSM using standard parametric models for the g-formula. Statistics in Medicine. 2014;33(6):1001-1014.
NR Latimer, IR White, K Tilling, and U Siebert. Improved two-stage estimation to adjust for treatment switching in randomised trials: g-estimation to address time-dependent confounding. Statistical Methods in Medical Research. 2020;29(10):2900-2918.
Jing Xu, Guohui Liu, and Bingxia Wang. Bias and type I error control in correcting treatment effect for treatment switching using marginal structural models in Phse III oncology trials. Journal of Biopharmaceutical Statistics. 2022;32(6):897-914.
simulated.data <- tssim(
tdxo = 0, coxo = 0, p_R = 0.5, p_X_1 = 0.3, p_X_0 = 0.3,
rate_T = 0.002, beta1 = -0.5, beta2 = 0.3,
gamma0 = 0.3, gamma1 = -0.9, gamma2 = 0.7, gamma3 = 1.1, gamma4 = -0.8,
zeta0 = -3.5, zeta1 = 0.5, zeta2 = 0.2, zeta3 = -0.4,
alpha0 = 0.5, alpha1 = 0.5, alpha2 = 0.4,
theta1_1 = -0.4, theta1_0 = -0.4, theta2 = 0.2,
rate_C = 0.0000855, followup = 20, days = 30,
n = 500, NSim = 100, seed = 314159)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.