[R] simulating 'non-standard' survival data

Frank E Harrell Jr fharrell at virginia.edu
Thu Mar 13 01:58:59 CET 2003


On Wed, 12 Mar 2003 13:01:12 +0100
vito muggeo <vito.muggeo at giustizia.it> wrote:

> Dear all,
> I'm looking for someone that help me to write an R function to simulate
> survival data under complex situations, namely time-varying hazard ratio,
> marginal distribution of survival times and covariates. The algorithm is
> described in the reference below and it should be not very difficult to
> implement it. However I tried but without success....;-(
> Below there the code that I used; it works but the relevant results (i.e.
> the estimates) are rather far from the true value; I cannot understand where
> the error is.
> 
> People interested in, could send me an e-mail privately.
> 
> best,
> vito
> 
> @article{mackenzie02,
>     author={T. Mackenzie and M. Abrahamowicz},
>     title={Marginal and hazard ratio specific random data: Applications to
> semi-parametric bootstrapping},
>     journal={Statistics and Computing},
>     volume={12},
>     year={2002},
>     pages={245-252}
> }
> 
. . .

You might look at the spower function in the Hmisc package.  It allows for complex situations such as a non-constant treatment effect on the hazard, a dropout function, a dropin function, staggered entry.  It only covers the two-sample case right now (no covariates) but it would not be too hard to add covariates (volunteers welcomed).  spower uses a trick where the time axis is discretized into for example a 2000-point grid.  That allows simple numerical integration to be used to factor in the complications, to get the cumulative hazard function and then do simulations off that.
-- 
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



More information about the R-help mailing list