km.coxph.plot: Function to plot several Kaplan-Meier survival curves

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Function to plot several Kaplan-Meier survival curves with number of individuals at risk at some time points.

Usage

1
2
3
4
km.coxph.plot(formula.s, data.s, weight.s, x.label, y.label, main.title, sub.title,
leg.text, leg.pos = "bottomright", leg.bty = "o", leg.inset = 0.05, o.text, v.line,
h.line, .col = 1:4, .lty = 1, .lwd = 1, show.n.risk = FALSE, n.risk.step,
n.risk.cex = 0.85, verbose = TRUE, ...)

Arguments

formula.s

formula composed of a Surv object and a strata variable (i.e. stratification).

data.s

data frame composed of the variables used in the formula.

weight.s

vector of weights of length nrow(data.s).

x.label

label for the y-axis.

y.label

label for the x-axis.

main.title

main title at the top of the plot.

sub.title

subtitle at the bottom of the plot.

leg.text

text in the legend.

leg.pos

the location may also be specified by setting 'x' to a single keyword from the list "bottomright", "bottom", "bottomleft", "left", "topleft", "top", "topright", "right" and "center". This places the legend on the inside of the plot frame at the given location.

leg.bty

the type of box to be drawn around the legend. The allowed values are "o" (the default) and "n".

leg.inset

inset distance from the margins as a fraction of the plot region. Default value is 0.05.

o.text

plot the logrank p-value.

v.line

x coordinate(s) for vertical line(s).

h.line

y coordinate(s) for horizontal line(s).

.col

vector of colors for the different survival curves.

.lty

vector of line types for the different survival curves

.lwd

vector of line widths for the different survival curves.

show.n.risk

if TRUE, show the numbers of samples at risk for each time step.

n.risk.step

vector specifying the time to be the steps for displaying the number of individuals at risk.

n.risk.cex

size of the number of individuals at risk. Default value is 0.85.

verbose

verbosity level (TRUE or FALSE). Default value is TRUE.

...

additional parameters to be passed to the plot function.

Details

The original version of this function was kindly provided by Dr Christos Hatzis (January, 17th 2006).

Value

Several Kaplan-Meier survival curves with number of individuals at risk at some time points.

Author(s)

Christos Hatzis, Benjamin Haibe-Kains

See Also

survfit, coxph

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
set.seed(12345)
stime <- rexp(100) * 10
cens   <- runif(100,.5,2) * 10
sevent  <- as.numeric(stime <= cens)
stime <- pmin(stime, cens)
strat <- sample(1:3, 100, replace=TRUE)
dd <- data.frame("surv.time"=stime, "surv.event"=sevent, "strat"=strat)
ddweights <- array(1, dim=nrow(dd))

km.coxph.plot(formula.s=Surv(surv.time, surv.event) ~ strat, data.s=dd,
  weight.s=ddweights, x.label="Time (years)", y.label="Probability of survival",
  main.title="", leg.text=paste(c("Low", "Intermediate", "High"), "   ", sep=""),
  leg.pos="topright", leg.inset=0, .col=c("darkblue", "darkgreen", "darkred"),
  .lty=c(1,1,1), show.n.risk=TRUE, n.risk.step=2, n.risk.cex=0.85, verbose=FALSE)

bhklab/survcomp documentation built on Dec. 26, 2021, 6:41 a.m.