log=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 survfit
plot(x, conf.int=, mark.time=FALSE,
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", conf.times, conf.cap=.005,
conf.offset=.012, …)
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, then curves are marked at the specified time points.
lines
help file contains examples of the possible marks.
The vector is reused cyclically if it is shorter than the number of
curves. If it is present this implies mark.time = TRUE
.
lines(surv.exp(...))
", say,
will perform as it did without the yscale
argument.
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 start.time
argument is used in survfit
, firstx
is set to that value.
xlim
graphical parameter, warning
messages about out of bounds points are not generated.
fun
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 generate a curve on square root scale.
Four often used transformations can be specified with a character
argument instead: "log"
is the same as using the log=T
option,
"event"
plots cumulative events (f(y) = 1-y),
"cumhaz"
plots the cumulative hazard function (f(y) = -log(y)), and
"cloglog"
creates a complimentary log-log survival plot (f(y) =
log(-log(y)) along with log scale for the x-axis).
"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 sides.
Type "S"
accomplishes this by manipulating the plot range and
then using the "i"
style internally.
x
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. When the conf.times
argument is used, the confidence bars are
offset by conf.offset
units to avoid overlap.
The bar on each curve are the confidence interval for the time point
at which the bar is drawn, i.e., different time points for each curve.
If curves are steep at that point, the visual impact can sometimes
substantially differ for positive and negative values of
conf.offset
.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\nfor 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