> Referees demand that the line in the KM-curve should be changed to > dotted at the point where standarerror is <= 10 %. I don't think it's > a good habit but I urgently need to implement such a thing in R with > survfit, survplot or another program. They also want numbers at risk > below the curve
To get such behaviour you have to "build your own". Here is an example. > fit <- survfit(Surv(time, status) ~1, data=lung) > plot(range(fit$time), range(fit$surv), type='n', xlab="Days") > sum(fit$time < 600) [1] 162 > lines(fit$time[1:162], fit$surv[1:162], type='s') > length(fit$time) [1] 186 > lines(fit$time[162:186], fit$surv[162:186], type='s', col=2) If you need confidence bands add more lines() for fit$upper and fit$lower. If you have more than one curve to overlay, do the fits separately and add even more lines commands. Now to add number at risk every 200 days: > temp <- summary(fit, times=c(0, 200, 400, 600, 800, 1000)) > text(c(0, 200, 400, 600, 800, 1000), .02, temp$n.risk) > text(c(0, 200, 400, 600, 800, 1000), temp$surv-.05, temp$n.risk) # Alternate I don't see a need to make a fancy function for this, as I expect you will only do it once. Just for my information: which journal came up with this `interesting' idea? 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.