[R] Sample from a hazard function

Frank E Harrell Jr fharrell at virginia.edu
Tue Oct 22 12:50:26 CEST 2002


On Tue, 22 Oct 2002 06:58:47 +0200
Christian Lederer <christianlederer at t-online.de> wrote:

> 
> Dear R-gurus,
> 
> is there a simple way to simulate of random deviates with a given hazard function? 
> Of course, one could do it by foot by calculating the inverse distribution function, 
> but perhaps someone knows a package which provides this (perhaps using a more
> elegant method).
> 
> Christian :-)

You might take a look at the spower function in the Hmisc library (http://hesweb1.med.virginia.edu/biostat/s/Hmisc.html) which does this quite simply by approximating the hazard function over a fine grid to turn the problem into a simple discrete distribution one.  spower does power simulation for 2-sample survival tests under complex conditions such as delated treatment effect, dropout, dropin, etc.
-- 
Frank E Harrell Jr              Prof. of Biostatistics & Statistics
Div. of Biostatistics & Epidem. Dept. of Health Evaluation Sciences
U. Virginia School of Medicine  http://hesweb1.med.virginia.edu/biostat
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list