[R] Survival Rate Estimates
Terry Therneau
therneau at mayo.edu
Fri May 13 14:49:18 CEST 2011
---begin included message --
Is there an automated way to use the survival package to generate
survival
rate estimates and their standard errors? To be clear, *not *the
survivorship estimates (which are cumulative), but the survival *rate *
estimates...
--- end --
The classic method in epidemiology is simple hazard rates = total
events / total time. This is done in more general form by the pyears
(person-years) routine.
pfit <- pyears(Surv(time, status) ~ agegrp + sex, data=mydata)
It's advantage over simple tables is the ability to do time-dependent
categories. For instance if I want death rates by decade of age:
acut <- tcut(mydata$age, 0:12 *10)
pfit2 <- pyears(time, status) ~ acut + sex, data=mydata)
The first table was based on age at the start, the second on current
age.
For non-parametric estimates of the hazard function look at the
"survival" task view on CRAN; there are several choices.
Terry Therneau
More information about the R-help
mailing list