Prof. Harrell, Thank you for your response. Potting the n.risk on the curve is probably only useful for a small data sets with a few censored events. The default present method is more general and has more applications. For my purpose I figured out a way of editing the postscript file in WinEdt.
Regards, Osman On 5/30/06, Frank E Harrell Jr <[EMAIL PROTECTED]> wrote: > > Osman Al-Radi wrote: > > Dear R-help > > > > How can one get survplot() to place the number at risk just below the > > survival curve as opposed to the default which is just above the x-axis? > > I tried the code bellow but the result is not satisfactory as some > numbers > > are repeated several times at different y coordinates and the position > of > > the n.risk numbers corresponds to the x-axis tick marks not the survival > > curve time of censoring. > > > > n <- 20 > > set.seed(731) > > cens <- 15*runif(n) > > h <- .02*exp(2) > > dt <- -log(runif(n))/h > > label(dt) <- 'Follow-up Time' > > e <- ifelse(dt <= cens,1,0) > > dt <- pmin(dt, cens) > > units(dt) <- "Year" > > S <- Surv(dt,e) > > km<-survfit(S~1) > > survplot(km,n.risk=T,conf='none', y.n.risk=unique(summary(km)$surv)) > > > > Any suggestion on addressing this problem would be apprecited. > > > > Also, is there a way to add a tick mark to the survival curve at times > of > > censoring similar to the mark.time=T argument in plot.survplot()? > > > > Thanks > > > > Osman > > > > Osman, > > y.n.risk has to be a scalar and gives the y-coordinate of the bottom > line of number at risk. I take it that you want the numbers not all at > the same height. This will require a customization of survplot or > fetching information from the km object and using text( ). > > Frank > -- > Frank E Harrell Jr Professor and Chair School of Medicine > Department of Biostatistics Vanderbilt University > -- Osman O. Al-Radi, MD, MSc, FRCSC Fellow, Cardiovascular Surgery The Hospital for Sick Children University of Toronto, Canada [[alternative HTML version deleted]] ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html