pwe_sim {goldilocks} | R Documentation |
Simulate piecewise exponential time-to-event outcomes
Description
Simulate time-to-event outcomes using the piecewise constant hazard exponential function.
Usage
pwe_sim(n = 1, hazard = 1, cutpoints = 0, maxtime = NULL)
Arguments
n |
integer. The number of random samples to generate. Default is
|
hazard |
vector. The constant hazard rates for exponential failures. |
cutpoints |
vector. The change-point vector indicating time when the
hazard rates change. Note the first element of |
maxtime |
scalar. Maximum time before end of study. |
Details
See pwe_impute
for details.
Value
A data frame with simulated follow-up times (time
) and
respective event indicator (event
, 1 = event occurred, 0 =
censoring).
Examples
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))
[Package goldilocks version 0.4.0 Index]