On Sep 22, 2010, at 8:15 PM, Krambrink, Amy M wrote:

> Hello,
>
>
>
> I'm using plot.survfit to plot cumulative incidence of an event.
> Essentially, my code boils down to:
>
> cox <-coxph(Surv(EVINF,STATUS) ~ strata(TREAT) + covariates, data=dat)
>
> surv <- survfit(cox)
>
> plot(surv,mark.time=F,fun="event")
>
> Follow-up time extends to 54 weeks, but the last event occurs at week
> 30, and no more people are censored in between.  Is there a direct way
> to extend the curves with a horizontal line to the end of follow-up  
> (54
> weeks), rather than stopping at the time of the last event (30 weeks)?

The survfit.coxph function only records the survival curve at the death
times, so there is no data in the "surv" object about time 54.  (This
will change in my next bundle of updates, which are currently under
test.)  You will need to update the survival curves' output by hand.
For now this would be the easiest code for multiple strata, at least
that I can think of offhand.

plot(surv, mark.time=F, fun='event', xlim=c(0, 54))
for (i in 1:length(surv$strata)) { #number of curves
        temp <- surv[i]
        lines(c(max(temp$time), 54), 1- rep(min(temp$surv),2))
        }

Terry Therneau

______________________________________________
R-help@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.

Reply via email to