[R] Show number at risk on Kaplan Meier curve

Frank E Harrell Jr f.harrell at vanderbilt.edu
Sun Dec 10 14:43:52 CET 2006


Mark Wardle wrote:
> Dear all,
> 
> I'm using the "survival" package with R 2.4.0 on Mac OS X 10.4.8.
> 
> I have two core statistics books (one of which is Altman's medical stats
> book) which suggest showing the number of individuals at risk at
> different time intervals on the Kaplan-Meier curve.
> 
> My plot shows two curves that later cross, because of one significant
> outlier.
> 
> I have two queries:
> 
> Is there an easy way of displaying number of individuals at risk at a
> specific time interval?
> 
> Is there a way to stop plotting when the number of individuals at risk
> reaches a certain minimum threshold to reduce the risk of such an
> outlier problem?
> 
> If there is no easy solution, then I suppose I shall have to perform the
> logic myself, calculating when individuals "drop out", and overlaying
> that onto the plot?
> 
> Many thanks,
> 
> Mark
> 

library(Design) # which also requires the Hmisc package
f <- cph( ..., surv=TRUE)
survplot(f, ..., n.risk=TRUE)

?survplot for details


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




More information about the R-help mailing list