[R] error bars on survival curve

Frank E Harrell Jr f.harrell at vanderbilt.edu
Sun Jun 17 16:38:39 CEST 2007


Murray Pung wrote:
> I am using plot(survfit(Surv(time,status) ~...) and would like to add
> error bars rather than the confidence intervals. Am I able to do this
> at specified times? e.g. when time = 20 & 40.
> 
> 
> leukemia.surv <- survfit(Surv(time, status) ~ x, data = aml)
> plot(leukemia.surv, lty = 2:3,xlim = c(0,50))
> #can i add error bars at times 20 & 40?
> legend(100, .9, c("Maintenance", "No Maintenance"), lty = 2:3)
> 
> 
> Thanks
> Murray

Error bars when done correctly should equal confidence intervals in the 
minds of many.

When the Design package is available again for the latest version of R, 
you can have more control using the survplot function, with bars and 
bands options.  Do ?survplot.survfit

Frank

-- 
Frank E Harrell Jr   Professor and Chair           School of Medicine
                      Department of Biostatistics   Vanderbilt University



More information about the R-help mailing list