Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: generating time for correlated competing events


From   Enzo Coviello <[email protected]>
To   [email protected]
Subject   st: generating time for correlated competing events
Date   Mon, 29 Oct 2007 19:12:49 +0100

Dear Stata Users,

to simulate survival data of two independent competing risks following an exponential distribution we can type:

set obs 5000
g time_ev1 = -1/ 0.2 * log(1-uniform())
g time_ev2 = -1/ 0.4 * log(1-uniform())
g time = min(time_ev1,time_ev2)
g byte fail = (time_ev1<time_ev2) + 2*(time_ev1>=time_ev2)

where 0.2 and 0.4 are the hazards we want simulate.

Now I need to simulate a competing event whose hazard is not independent from the hazard of the first event.
How can a new time variable be generated:

g time_ev3 = ?


Thanks

Enzo



Enzo Coviello
Unit� di Epidemiologia e Statistica ASL BARI
Piazza V. Emanuele 14 - 70054 Giovinazzo (Bari)
tel./fax +39 080 3357867
mobile 347 5016 016
home +39 0883 695055


*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index