r - Plotting survfit -


i'm new r , trying plot survfit survival curves.

in playing around survfit object, found 2 different plots following:

library(survival)  #example survfit object mysurvfit <- survfit(surv(time, status)~1, data=aml)  #default survfit plot, survival curve upper & lower conf intervals plot(mysurvfit, mark.time=false, conf.int=true)  #create curve accessing surv, upper, lower #(i'd expect produce same above, doesn't) lines(mysurvfit$surv, col="blue",lty=1) lines(mysurvfit$upper, col="blue",lty=2) lines(mysurvfit$lower, col="blue",lty=2) 

why these curves different? missing survfit object?

you missing time variable

try

plot(mysurvfit, mark.time=false, conf.int=true) lines(mysurvfit$surv ~ mysurvfit$time, col="blue",lty=1) lines(mysurvfit$upper ~ mysurvfit$time, col="blue",lty=2) lines(mysurvfit$lower ~ mysurvfit$time, col="blue",lty=2) 

which looks like

mysurvfit


Comments