plot.Cuminc: Plot method for Cuminc objects

Description Usage Arguments Details Value Author(s) Examples

View source: R/plot.Cuminc.R

Description

Plot the estimates of the non-parametric Aalen-Johansen estimate of the cumulative incidence functions (competing risks data). Note this is a method for mstate::Cuminc and not cmprsk::cuminc. Both return the same estimates, though the former does so in a dataframe, and the latter in the list.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## S3 method for class 'Cuminc'
plot(
  x,
  use.ggplot = FALSE,
  xlab = "Time",
  ylab = "Probability",
  xlim,
  ylim,
  lty,
  legend,
  cols,
  conf.type = c("log", "plain", "none"),
  conf.int = 0.95,
  legend.pos = "right",
  facet = FALSE,
  ...
)

Arguments

x

Object of class "Cuminc" to be printed or plotted

use.ggplot

Default FALSE, set TRUE for ggplot version of plot

xlab

A title for the x-axis; default is "Time"

ylab

A title for the y-axis; default is "Probability"

xlim

The x limits of the plot(s), default is range of time

ylim

The y limits of the plot(s); if ylim is specified for type="separate", then all plots use the same ylim for y limits

lty

The line type, see par; default is 1

legend

Character vector corresponding to number of absorbing states. In case of a grouped "Cuminc" object, with facet = FALSE the length of the vector is number absorbing states * group levels. Only relevant when use.ggplot = TRUE

cols

Vector (numeric or character) specifying colours of the lines

conf.type

Type of confidence interval - either "log" or "plain" . See function details for details.

conf.int

Confidence level (%) from 0-1 for probabilities, default is 0.95 (95% CI). Setting to 0 removes the CIs.

legend.pos

The position of the legend, see legend; default is "topleft"

facet

Logical, in case of group used for "Cuminc", facet by it - only relevant when use.ggplot = TRUE

...

Further arguments to plot or print method

Details

Grouped cumulative incidences can be plotted either in the same plot or in facets, see the facet argument.

Value

A ggplot object if use.ggplot = T used, otherwise NULL.

Author(s)

Edouard F. Bonneville e.f.bonneville@lumc.nl

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
library(ggplot2)

data("aidssi")
head(aidssi)
si <- aidssi

# No grouping
cum_incid <- Cuminc(
time = "time",
status = "status",
data = si
)

plot(
x = cum_incid,
use.ggplot = TRUE,
conf.type = "none",
lty = 1:2,
conf.int = 0.95
)

# With grouping
cum_incid_grp <- Cuminc(
time = "time",
status = "status",
group = "ccr5",
data = si
)

plot(
 x = cum_incid_grp,
 use.ggplot = TRUE,
 conf.type = "none",
 lty = 1:4, 
 facet = TRUE 
)
  

mstate documentation built on Nov. 8, 2021, 5:06 p.m.