Description Usage Arguments Details Value Author(s) See Also Examples
Function to plot several Kaplan-Meier survival curves with number of individuals at risk at some time points.
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, ...)
|
formula.s |
formula composed of a |
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 |
leg.bty |
the type of box to be drawn around the legend. The allowed values are |
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 |
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 ( |
... |
additional parameters to be passed to the |
The original version of this function was kindly provided by Dr Christos Hatzis (January, 17th 2006).
Several Kaplan-Meier survival curves with number of individuals at risk at some time points.
Christos Hatzis, Benjamin Haibe-Kains
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)
|
Loading required package: survival
Loading required package: prodlim
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.