Re: [R] Compare mean survival time

From: Terry Therneau <therneau_at_mayo.edu>
Date: Wed, 20 Feb 2008 08:20:58 -0600 (CST)


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



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed 20 Feb 2008 - 14:32:19 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 20 Feb 2008 - 15:30:15 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive