plotCIF | R Documentation |
Function plotCIF
plots, for one or more groups, the
cumulative incidence curves for a selected event out of two or more
competing events. Function stackedCIF
plots, for one group or
population, the cumulative incidence curves for two or more competing
events such that the cumulative incidences are stacked upon each
other. The CIFs are are estimated by the Aalen-Johansen method.
## S3 method for class 'survfit'
plotCIF( x, event = 1,
xlab = "Time",
ylab = "Cumulative incidence",
ylim = c(0, 1),
lty = 1,
col = "black", ... )
## S3 method for class 'survfit'
stackedCIF( x, group = 1,
col = "black",
fill = "white",
ylim = c(0,1),
xlab = "Time",
ylab = "Cumulative incidence", ... )
x |
An object of class |
event |
Determines the event for which the cumulative incidence
curve is plotted by |
group |
An integer showing the selected level of a possible
grouping factor appearing in the model formula in |
col |
A vector specifying the plotting color(s) of the curve(s) for
the different groups in |
fill |
A vector indicating the colours to be used for shading the
areas pertinent to the separate outcomes in |
xlab |
Label for the $x$-axis. |
ylab |
Label for the $y$-axis. |
ylim |
Limits of the $y$-axis. |
lty |
A vector specifying the line type(s) of the curve(s) for the different groups - default: all 1 (=solid). |
... |
Further graphical parameters to be passed. |
The order in which the curves with stackedCIF
are piled
upon each other is the same as the ordering of the values or levels of
the competing events in the pertinent event variable. The ordering can
be changed by permuting the levels as desired using function
Relevel
, after which survfit
is called with the relevelled
event
variable in Surv()
No value is returned but a plot is produced as a side-effect.
Aalen-Johansen curves for competing events in several groups can also
be plotted by function plot.survfit
of the survival
library as well as by some functions in other packages covering analysis
of time-to-event data.
Esa Laara, esa.laara@oulu.fi
Putter, H., Fiocco, M., Geskus, R.B. (2007). Tutorial in biostatistics: competing risks and multi-state models. Statistics in Medicine, 26: 2389–2430.
survfit
,
plot
,
plot.survfit
.
library(survival) # requires version 2.39-4 or later
head(mgus1)
# Aalen-Johansen estimates of CIF are plotted by sex for two
# competing events: (1) progression (pcm), and (2) death, in
# a cohort of patients with monoclonal gammopathy.
# The data are actually covering transitions from pcm to death, too,
# for those entering the state of pcm. Such patients have two rows
# in the data frame, and in their 2nd row the 'start' time is
# the time to pcm (in days).
# In our analysis we shall only include those time intervals with value 0
# for variable 'start'. Thus, the relevant follow-up time is represented
# by variable 'stop' (days). For convenience, days are converted to years.
fitCI <- survfit(Surv(stop/365.25, event, type="mstate") ~ sex,
data= subset(mgus1, start==0) )
par(mfrow=c(1,2))
plotCIF(fitCI, event = 1, col = c("red", "blue"),
main = "Progression", xlab="Time (years)" )
text( 38, 0.15, "Men", pos = 2)
text( 38, 0.4, "Women", pos = 2)
plotCIF(fitCI, event = 2, col = c("red", "blue"),
main = "Death", xlab="Time (years)" )
text( 38, 0.8, "Men", pos = 2)
text( 38, 0.5, "Women", pos = 2)
par(mfrow=c(1,2))
stackedCIF(fitCI, group = 1, fill = c("gray80", "gray90"),
main = "Women", xlab="Time (years)" )
text( 36, 0.15, "PCM", pos = 2)
text( 36, 0.6, "Death", pos = 2)
stackedCIF(fitCI, group = 2, fill = c("gray80", "gray90"),
main = "Men", xlab="Time (years)" )
text( 39, 0.10, "PCM", pos = 2)
text( 39, 0.6, "Death", pos = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.