survfit
objectslog=T
option does extra work to avoid log(0), and to try to create a
pleasing result. If there are zeros, they are plotted by default at
0.8 times the smallest non-zero value on the curve(s).Curves are plotted in the same order as they are listed by print
(which gives a 1 line summary of each).
This will be the order in which col
, lty
, etc are used.
## S3 method for class 'survfit':
plot(x, conf.int=, mark.time=TRUE,
mark=3, col=1, lty=1, lwd=1, cex=1, log=FALSE, xscale=1, yscale=1,
firstx=0, firsty=1, xmax, ymin=0, fun,
xlab="", ylab="", xaxs="S", \dots)
survfit
, usually returned by the
survfit
function.FALSE
, no
labeling is done.
If TRUE
, then curves are marked at each censoring time which
is not also a death time. If mark.time
is a
numeric vector, lines
help file contains examples of the possible marks.
The vector is reused cyclically if it is shorter than the number of curves.lines(surv
yscale
for labels on the x axis.
A value of 365.25 will give labels in years instead of the original days.NA
the plot will start at the first time point of the curve.
By default, the plot program obeys tradition by having the plot start at
(0,0).If
xlim
graphical parameter, warning
messages about out of bounds points arefun
argument is present,
or if it has been set to NA
.fun=log
is an alternative way to draw a log-survival curve
(but with the axis labeled with log(S) values),
and fun=sqrt
would gener"S"
for a survival curve or a standard x axis style as
listed in par
.
Survival curves are usually displayed with the curve touching the y-axis,
but not touching the bounding box of the plot on the other 3 sidesx
and y
, containing the coordinates of the last point
on each of the curves (but not the confidence limits).
This may be useful for labeling.survfit
function creates a multi-state survival curve
the resulting object also has class `survfitms'.
Competing risk curves are a common case. The only difference in
the plots is that multi-state defaults to a curve that goes from lower
left to upper right (starting at 0), where survival curves by default
start at 1 and go down. All other options are identical.points.survfit
,
lines.survfit
,
par
,
survfit
leukemia.surv <- survfit(Surv(time, status) ~ x, data = aml)
plot(leukemia.surv, lty = 2:3)
legend(100, .9, c("Maintenance", "No Maintenance"), lty = 2:3)
title("Kaplan-Meier Curves
for AML Maintenance Study")
lsurv2 <- survfit(Surv(time, status) ~ x, aml, type='fleming')
plot(lsurv2, lty=2:3, fun="cumhaz",
xlab="Months", ylab="Cumulative Hazard")
Run the code above in your browser using DataLab