I want to create a simulation study for two competing events (K=2) with exponential hazard function of lambda 1 = 0.5 and lambda 2 = 1.5.
How to generate the competing risk data with the simulation scheme below with R coding?
(i) with lambda 1 and lambda 2, simulate a failure time T using all cause hazards lambda 1 + lambda 2. (ii) for determining the cause of T generated in (i), run a binomial experiment with a probability (lambda 1/ lambda 1 + lambda 2) on cause 1. (iii) generate a right censoring time, C~Unif(c1,c2) where c1 and c2 are determined to a censoring rate.