| To: | jsorkin@grecc.umaryland.edu |
|---|---|
| Subject: | Re: Simulation of survival data to produce sample size estimate. |
| From: | Terry Therneau <therneau@mayo.edu> |
| Date: | Tue, 17 Jun 2003 08:24:37 -0500 (CDT) |
| Cc: | s-news@lists.biostat.wustl.edu |
| Reply-to: | Terry Therneau <therneau@mayo.edu> |
Why not use the actual survival curve?
Assume a male, enrolled at age 50 in 1990:
> tdata <- data.frame(age=50*365.25, sex=1, year=chron('1/1/1990'))
> esurv <- survexp(~1, data=tdata, ratetable=survexp.us, times=(0:50)*365.25)
> plot(esurv$time/365, esurv$surv)
This gives a survival curve, now grab random survival times off of it:
> ntime <- 300
> times <- approx(esurv$surv, esurv$time, runif(ntime))$y
Splus has the US, US by race, Minnesota, Florida, and Arizona tables
built in. (Since the rate tables are stored in terms of rate/day, all
use of them has to be in days. Hence the multiplication/division by
365.25). The approx function just does linear interpolation.
Terry Therneau
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: observation number, Sundar Dorai-Raj |
|---|---|
| Next by Date: | Re: observation number, jingshan zhang |
| Previous by Thread: | Re: Simulation of survival data to produce sample size estimate., Spencer Graves |
| Next by Thread: | how do i get rid of my audit file ?, Leeds, Mark |
| Indexes: | [Date] [Thread] [Top] [All Lists] |