Learn R Programming

eha (version 2.5.1)

plot.Surv: Plots of survivor functions.

Description

Kaplan-Meier estimates. If only one curve, confidence limits according to Greenwood's formula are drawn.

Usage

# S3 method for Surv
plot(x, strata = NULL, fn = c("cum", "surv", "log",
  "loglog"), limits = TRUE, conf = 0.95, main = NULL, xlab = NULL,
  ylab = NULL, xlim = NULL, ylim = NULL, lty = NULL, col = NULL,
  lty.con = NULL, col.con = NULL, x.axis = TRUE, printLegend = TRUE,
  ...)

Arguments

x

A Surv object.

strata

Defines a partition of the data. One survivor function for each level of strata is drawn.

fn

Which type of plot?

limits

If TRUE, and if the number of curves is one, confidence limits are drawn.

conf

The confidence level for the confidence limits.

main

A heading for the plot.

xlab

Label on the x axis.

ylab

Label on the y-axis.

xlim

Horizontal plot limits. If NULL, calculated by the function.

ylim

Vertical plot limits. If NULL, set to c(0, 1)

lty

Line type of curves.

col

Color of curves.

lty.con

Line type of confidence bands.

col.con

Color of confidence bands.

x.axis

Should abline(h=0) be drawn?

printLegend

Logical, defaults to TRUE. If FALSE, no legend is printed, but can be added after plotting. To be used if the default place for the legend fits badly.

...

Anything that plot likes...

Value

No value is returned.

Details

Left truncation is allowed. Note, though, that this fact may result in strange estimated curves due to lack of data in certain (low) ages.

Examples

Run this code
# NOT RUN {
time0 <- numeric(50)
group <- c(rep(0, 25), rep(1, 25))
time1 <- rexp( 50, exp(group) )
event <- rep(1, 50)
plot(Surv(time0, time1, event), strata = group)

# }

Run the code above in your browser using DataLab