Jie
2012-Aug-17 16:57 UTC
[R] sample from a joint distribution of discrete & continuous variables (survival analysis)
Dear All, My question is from the simulation of survival time with censoring indicator. Suppose I have a person with: 1. exponential life time, h(t) = lambda* exp(- lambda* t), some known lambda>0. 2. a pre-determined event time, constant T; 3. a censoring indicator, delta=0 if the observed life time is greater than T, =1 other wise. I would like to sample (t, delta). According to some textbooks in this field, the joint distribution f (t, delta) = h(t) ^ delta * S(t) ^ (1 - delta) = lambda ^ delta * S(t) , where S(t) = integrated h(s) from 0 to t. = lambda^ delta * exp (- lambda*t ) What I did earlier was to sample t from the h(t), compare it with T and obtain delta, But I am not confidient with this approach. Could anyone give an example or idea, please? And in general, how do solve this kind of problem? Inversing the uniform random variable is only for continuous case? Thank you for your time. Best wishes, Jie [[alternative HTML version deleted]]