[R] newbie estimating survival curve w/ survfit for coxph

Terry Therneau therneau at mayo.edu
Fri Dec 22 15:06:09 CET 2006


 fit <- coxph(Surv(futime,fustat)~ age +strata(rx), data=ovarian,
 	              subset=1:23)
 curves <- survfit(fit, newdata=ovarian[24:26,])
 

 I don't think this is mentioned in the documentation (I'll have to fix that!),
but subscripting works for survfit objects.  In this case there are 2 strata
and 3 subjects, and

   curves[1,2]  will return the survival curve for strata 1, subject 2.
   curves[2,1]  will return the survival curve for strata 2, subject 1,
etc.

	Terry Therneau



More information about the R-help mailing list