# Example 1
# Piecewise uniform (piecewise exponential inter-arrival times) for 10k patients enrollment
# Enrollment rates of 5 for time 0-100, 15 for 100-300, and 30 thereafter
x <- rpwexp_enroll(
n = 1e5,
enroll_rate = data.frame(
rate = c(5, 15, 30),
duration = c(100, 200, 100)
)
)
plot(x, 1:1e5,
main = "Piecewise uniform enrollment simulation",
xlab = "Time",
ylab = "Enrollment"
)
# Example 2
# Exponential enrollment
x <- rpwexp_enroll(
n = 1e5,
enroll_rate = data.frame(rate = .03, duration = 1)
)
plot(x, 1:1e5,
main = "Simulated exponential inter-arrival times",
xlab = "Time",
ylab = "Enrollment"
)
Run the code above in your browser using DataLab