powered by
The function produces n realizations of a piecewise-exponentially distributed random waiting time.
r.pw_exp(n, breakpoints, rates)
Vector of waiting times, drawn randomly from a piecewise-exponential survival function.
Number of random draws
Breakpoints in piecewise-exponential distribution
Piecewise-constant rates
breakpoints <- c(0, 10, 20, 30, 60) rates <- c(0.01,0.02,0.04,0.15) pw_sample <- VirtualPop::r.pw_exp (n=10, breakpoints, rates=rates)
Run the code above in your browser using DataLab