Skip to content

Show number at risk on Kaplan Meier curve

4 messages · Charles C. Berry, Frank E Harrell Jr, Mark Wardle

#
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
#
On Sat, 9 Dec 2006, Mark Wardle wrote:

            
The R questions are easily answered.

-------------
Look at

 	?survfit.object

These commands will plot while the risk set exceeds 5 and indicate at the 
bottom what the risk set sizes are at each step.
-------------

However, as to whether this 'reduces the risk of an outlier problem', 
failing to show what you think of as an 'outlier' may not be good 
statistical practice. Some treatments do indeed have crossing survival 
curves, and your 'outlier' may be the tip of an unexpected, emerging 
(albeit dimly perceived) iceberg.

HTH
Charles C. Berry                        (858) 534-2098
                                          Dept of Family/Preventive Medicine
E mailto:cberry at tajo.ucsd.edu	         UC San Diego
http://biostat.ucsd.edu/~cberry/         La Jolla, San Diego 92093-0717
#
Mark Wardle wrote:
library(Design) # which also requires the Hmisc package
f <- cph( ..., surv=TRUE)
survplot(f, ..., n.risk=TRUE)

?survplot for details
#
Frank E Harrell Jr wrote:

            
Thank you for the replies.

Both solutions perfectly - and I've now another package to experiment
with - so I'm very grateful!

My work is looking at natural history rather than the effects of an
intervention, so I'm not too worried about stopping the curves when
there are one or two long-lifers. I think that is a reasonable thing to
do anyway!

Best wishes,

Mark