[R] Is the output of survfit.coxph survival or baseline survival?

David Winsemius dwinsemius at comcast.net
Sat Oct 1 17:25:17 CEST 2011


On Sep 30, 2011, at 9:31 PM, koshihaku wrote:

> Dear all,
> I am confused with the output of survfit.coxph.
> Someone said that the survival given by summary(survfit.coxph) is the
> baseline survival S_0, but some said that is the survival  
> S=S_0^exp{beta*x}.
>
> Which one is correct?

It may depend on who _some_ and _someone_ mean by S_0 and who they  
are. I have in the past posted erroneous answers, but the name on  
which to search the archives is 'Terry Therneau'. My current  
understanding is that the survival S_0 is the estimated survival for a  
hypothetical subject whose continuous and discrete covariates are all  
at their means. (But I have been wrong before.) Here is some of what  
Therneau has said about it:

http://finzi.psych.upenn.edu/Rhelp10/2010-October/257941.html
http://finzi.psych.upenn.edu/Rhelp10/2009-March/190341.html
http://finzi.psych.upenn.edu/Rhelp10/2009-February/189768.html

>
> By the way, if I use "newdata=" in the survfit, does that mean the  
> survival
> is estimated by the value of covariates in the new data frame?

In one sense yes, but in another sense, no. If you have a cox fit and  
you  supply newdata, the beta estimates and the baseline survival come  
from in the original data. If you just give it a formula, then there  
is no newdata argument, only a data argument.

Try this:
  fit <- coxph( Surv(futime, fustat)~rx, data=ovarian)
  plot( survfit(fit, newdata=data.frame(rx=1) ) )
  plot( survfit( Surv(futime, fustat)~rx, data=ovarian) )

Then flipping back and forth between those curves might clarify, at  
least to the extent that I understand this question.

And here's a pathological extrapolation:

  plot(survfit(fit, newdata=data.frame(rx=1:3)))

# There is no rx=3 in the original data but it wasn't defined as a  
factor when given to coxph.
# Just checked to see if you could extrapolate past the end of a range  
of factors and very sensibly you cannot.
 > fit <- coxph( Surv(futime, fustat)~factor(rx), data=ovarian)
 > plot(survfit(fit, newdata=data.frame(rx=1:3)))
Error in model.frame.default(data = data.frame(rx = 1:3), formula =  
~factor(rx),  :
   factor 'factor(rx)' has new level(s) 3


-- 
David.



More information about the R-help mailing list