My goal is to simulate a data set that can be used to test a competing risk
model. I am just trying a simple example with the survsim::crisk.sim
function but
it does not lead to the results I expect.
require(survival)
simulated_data <- survsim::crisk.sim(n = 100,
foltime = 200,
dist.ev = rep("weibull", 2),
anc.ev = c(0.8, 0.9),
beta0.ev = c(2, 4),
anc.cens = 1,
beta0.cens = 5,
nsit = 2)
model <- survreg(Surv(time, status) ~ 1 + strata(cause), data = simulated_data)
exp(model$scale)
## cause=1 cause=2
## 4.407839 2.576357
I would expect these numbers to be the same as beta0.ev
. Any pointers to what
I might do wrong or other suggestions how to simulate competing risk data.
For completion: I would like the events in the simulated data to occur following a Weibull distribution that is different for each risk. I would like to be able to specify a strata and cluster in the data. The censoring can follow a Weibull or Bernouli distribution.