[R] Compare mean survival time

Terry Therneau therneau at mayo.edu
Wed Feb 20 15:20:58 CET 2008


Xing Yuan wrote:
> Dear List,
> 
> Does anybody no how to compare mean survival times for two (more) groups in
> R? What test statistics should I use?

   Because of censoring, you can only compare the conditional means.  That is, 
given a pre-defined cutpoint such as "2 years", you estimate the expected amount 
of the next 2 years that a person in each group will experience.  For stability 
you need to have the cutpoint be smaller than the larger censoring times.  (If 
no one has more than 2 years of fu, setting the cutpoint to 5 years is silly).
   The current survfit routine calculates the conditional mean and se() thereof 
for each curve.  Unfortunately, it chooses the cutpoint per curve, as the 
largest time value in that curve.  To make the numbers from two curves 
comparable, they need to have a common cutpoint.  And, as Thomas L has pointed 
out to me, the cutpoint value should not be a value derived from the data, since 
the se calculation is under the assumption of a fixed cutpoint.  This is easily 
done by preprocessing the data.  (The cutpoint must be small enough so that 
every curve is "cut off" somewhat for this to work).
   	newtime <- pmin(time, cutpoint)
   	newstat <- ifelse(time<=cutpoint, status, 0)
   	fit <- survfit(Surv(newtime, newstat) ~ group)
   	print(fit, show.rmean=T)

(This will be easier in the future, by giving a cutpoint to the print function).  	


Since the curves are independent, the variance of the difference in means is the 
sum of the variances.

	Terry Therneau



More information about the R-help mailing list