[R] Generate random variate from a non-parametric hazard function

Peter Dalgaard p.dalgaard at biostat.ku.dk
Sat Oct 24 13:38:28 CEST 2009

Samiul Hasan wrote:
> Hi
> I have estimated a hazard function using a kernel based method. Now i have
> to generate a random variate that follows this hazard function. Does any one
> know method I should use to generate the variate.
> Thanks
> Samiul

As far as I remember, the relation that you need is that if Lambda is 
the _integrated_ intensity function for a random variable X, then 
Lambda(X) has a unit exponential distribution. So the strategy is to 
figure out how to calculate and invert Lambda, then use invLambda(rexp(N)).

    O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
   c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
  (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)              FAX: (+45) 35327907

More information about the R-help mailing list