[R] survival::survfit,plot.survfit

Bernhard Reinhardt bernhard.reinhardt at dlr.de
Thu Feb 26 10:03:24 CET 2009

Jeff Xu wrote:
> I am confused when trying the function survfit.
> my question is:  what does the survival curve given by plot.survfit mean?
> is it the survival curve with different covariates at different points?
> or just the baseline survival curve?
> for example, I run the following code and get the survival curve
> ####
> library(survival)
> fit<-coxph(Surv(futime,fustat)~resid.ds+rx+ecog.ps,data=ovarian)
> plot(survfit(fit,type="breslow"))
> summary(survfit(fit,type="breslow"))
> ####
> for the first two failure points, we have s(59|x1)=0.971, s(115|x2)=0.942
> how can we guarantee that s(59|x1) is always greater than s(115|x2)?
> since s(59|x1)=s_0(59)^exp(\beta'x1) and s(115|x2)=s_0(115)^exp(\beta'x2),
> we can manipulate covariates to make s(59|x1) < s(115|x2), right?
> do I miss anything?

In advance: I´m a beginner in survival analysis, too. But I think I can 
help you with this.

plot(survfit(fit)) should plot the survival-function for x=0 or 
equivalently beta'=0. This curve is independent of any covariates.

If you want to see the impact of residual-status=2 you could add 
something like:

ovarian_new <- data.frame(resid.ds=2, 

plot(survfit(fit), newdata=ovarian_new)

This should give you the survival-function for an average patient with 
residual-status 2.



More information about the R-help mailing list