Often used to add the expected survival curve(s) to a KaplanMeier plot
generated with plot.survfit
.
1 2 3 4 5 6 7 8 9 10  ## S3 method for class 'survfit'
lines(x, type="s", mark=3, col=1, lty=1,
lwd=1, cex=1, mark.time=FALSE,
xscale=1, firstx=0, firsty=1, xmax, fun, conf.int=FALSE,
conf.times, conf.cap=.005, conf.offset=.012, ...)
## S3 method for class 'survexp'
lines(x, type="l", ...)
## S3 method for class 'survfit'
points(x, xscale, xmax, fun, censor=FALSE, col=1, pch,
...)

x 
a survival object, generated from the 
type 
the line type, as described in 
mark, col, lty, lwd, cex 
vectors giving the mark symbol, color, line type, line width and
character size for the added curves. Of this set only color is
applicable to 
pch 
plotting characters for points, in the style of

censor 
should censoring times be displayed for the 
... 
other graphical parameters 
mark.time 
controls the labeling of the curves.
If 
xscale 
this parameter is no longer necessary and is ignored. See the
note in 
firstx, firsty 
the starting point for the survival curves. If either of these is set to

xmax 
the maximum horizontal plot coordinate.
This shortens the curve before plotting it, so unlike using the

fun 
an arbitrary function defining a transformation of the survival curve.
For example 
conf.int 
if 
conf.times 
optional vector of times at which to place a confidence bar on the curve(s). If present, these will be used instead of confidence bands. 
conf.cap 
width of the horizontal cap on top of the confidence bars; only used if conf.times is used. A value of 1 is the width of the plot region. 
conf.offset 
the offset for confidence bars, when there are multiple curves on the plot. A value of 1 is the width of the plot region. If this is a single number then each curve's bars are offset by this amount from the prior curve's bars, if it is a vector the values are used directly. 
When the survfit
function creates a multistate survival curve
the resulting object has class ‘survfitms’. The only difference in
the plots is that that it defaults to a curve that goes from lower
left to upper right (starting at 0), where survival curves default
to starting at 1 and going down. All other options are identical.
a list with components x
and y
, containing the coordinates of the
last point on each of the curves (but not of the confidence limits).
This may be useful for labeling.
one or more curves are added to the current plot.
lines
, par
, plot.survfit
, survfit
, survexp
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14  fit < survfit(Surv(time, status==2) ~ sex, pbc,subset=1:312)
plot(fit, mark.time=FALSE, xscale=365.25,
xlab='Years', ylab='Survival')
lines(fit[1], lwd=2) #darken the first curve and add marks
# Add expected survival curves for the two groups,
# based on the US census data
# The data set does not have entry date, use the midpoint of the study
efit < survexp(~ ratetable(sex=sex,age=age*365.35,year=as.Date('1979/1/1')) +
sex, data=pbc, times=(0:24)*182)
temp < lines(efit, lty=2, lwd=2:1)
text(temp, c("Male", "Female"), adj= .1) #labels just past the ends
title(main="Primary Biliary Cirrhosis, Observed and Expected")

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.