[R] survival analysis: plot.survfit
Ruth Meili
meili at stat.math.ethz.ch
Fri Aug 2 11:36:46 CEST 2002
Hello everybody,
does anybody know how the function plot.survfit exactly works?
I'd like to plot the log of the cummulative hazard against the
log time by using plot.survfit(...fun="cloglog") which does not
work correctly. The scales are wrong and there is an error
message about infinit numbers. It must have something to do with
the censored data, doesn't it?
#Example:
motorette <-
read.table("http://stat.ethz.ch/Teaching/Datasets/NDK/motorette.dat",header=T)
km <- survfit(Surv(time,status)~1,data=motorette,type="kaplan-meier")
plot(km,fun="cloglog") # Error message and wrong scales
plot(km,fun="cumhaz",log="xy") # Does the same.
#If I do the plot "by hand", it does work:
log.cum.H <- log(-log(km$surv))
log.t <- log(summary(km,censored=T)$time)
plot(log.t,log.cum.H,type="s")
regards
Ruth
--
Ruth Meili <meili at stat.math.ethz.ch>
Seminar fuer Statistik, LEO D6
ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND
phone: x-41-1-632-4684 fax: x-41-1-632-1228
http://stat.ethz.ch/~meili/
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list