Competing risks model for simulation
crModel()
A structural equation model initialized with four variables: the latent event times of two causes, the latent right censored time, and the observed right censored event time.
Create a competing risks model with to causes to simulate a right censored event time data without covariates
This function requires the lava
package.
library(lava)
m <- crModel()
d <- sim(m,6)
print(d)
#> eventtime1 eventtime2 censtime time event
#> 1 11.378608 4.255580 10.142075 4.255580 2
#> 2 7.678317 4.598606 9.256727 4.598606 2
#> 3 16.445745 5.749375 5.704949 5.704949 0
#> 4 3.275703 3.640685 5.343199 3.275703 1
#> 5 5.053483 12.332235 8.790858 5.053483 1
#> 6 2.457303 10.226655 6.538515 2.457303 1