powered by
Simulate time-to-event outcomes using the piecewise constant hazard exponential function.
pwe_sim(n = 1, hazard = 1, cutpoints = 0, maxtime = NULL)
integer. The number of random samples to generate. Default is n=1.
n=1
vector. The constant hazard rates for exponential failures.
vector. The change-point vector indicating time when the hazard rates change. Note the first element of cutpoints should always be 0.
cutpoints
scalar. Maximum time before end of study.
A data frame with simulated follow-up times (time) and respective event indicator (event, 1 = event occurred, 0 = censoring).
time
event
See pwe_impute for details.
pwe_impute
# NOT RUN { pwe_sim(10, hazard = c(0.005, 0.001), cutpoints = c(0, 3), maxtime = 36) y <- pwe_sim(n = 1, hazard = c(2.585924e-02, 3.685254e-09), cutpoints = c(0, 12)) # }
Run the code above in your browser using DataLab