r - Simulate competing risk data -


my goal simulate data set can used test competing risk model. trying simple example survsim::crisk.sim function not lead results 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 expect these numbers same beta0.ev. pointers might wrong or other suggestions how simulate competing risk data.

for completion: events in simulated data occur following weibull distribution different each risk. able specify strata , cluster in data. censoring can follow weibull or bernouli distribution.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -