Simulate a complete clinical trial with event data drawn from a piecewise exponential distribution
sim_comp_data(
hazard_treatment,
hazard_control = NULL,
cutpoints = 0,
N_total,
lambda = 0.3,
lambda_time = 0,
end_of_study,
block = 2,
rand_ratio = c(1, 1),
prop_loss = 0
)
A data frame with 1 row per subject and columns:
time:
numeric. Time of event or censoring time.
treatment:
integer. Treatment arm with values 1L
for experimental arm, and
0L
for control arm (only if hazard_control
is given).
event:
integer. Indicator of whether event occurred (=1L
if occurred
and =0L
if right-censored).
enrollment:
numeric. Time of patient enrollment relative to time trial enrolled first patient.
id:
integer. Identification number for each patient.
loss_to_fu:
logical. Indicator of whether the patient was lost to follow-up during the course of observation.
vector. Constant hazard rates under the treatment arm.
vector. Constant hazard rates under the control arm.
vector. Times at which the baseline hazard changes. Default
is cutpoints = 0
, which corresponds to a simple (non-piecewise)
exponential model.
integer. Maximum sample size allowable
vector. Enrollment rates across simulated enrollment times. See
enrollment
for more details.
vector. Enrollment time(s) at which the enrollment rates
change. Must be same length as lambda. See enrollment
for
more details.
scalar. Length of the study; i.e. time at which endpoint will be evaluated.
scalar. Block size for generating the randomization schedule.
vector. Randomization allocation for the ratio of control
to treatment. Integer values mapping the size of the block. See
randomization
for more details.
scalar. Overall proportion of subjects lost to follow-up. Defaults to zero.