CIFplot: Plotting estimates of the cumulative incidence function

Description Usage Arguments See Also Examples

View source: R/CIFplot.R

Description

Function for plotting parametric estimates of the cumulative incidence function based on incidence rates. If individual patient data is available, the function also enables to plot the non-parametric, Aalen-Johansen estimates using etm.

Usage

1
2
CIFplot(x, event.code = NULL, covar.code = NULL, indiv.times = NULL, indiv.events = NULL, indiv.covar = NULL, 
xlim = c(0, 30), ylim = NULL, xlab = "Time", ylab = "CIF", legend = TRUE, ...)

Arguments

x

irates object

event.code

A character or numerical value that specifies the respective competing events for which the CIF shall be plotted. If NULL, event.code will be inherited from irates

covar.code

A character or numerical value that specifies the respective covariate vlaues for which the CIF shall be plotted. If NULL, covar.code will be inherited from irates

indiv.times

Timepoints corresponding to event status for each individual (vector or factor). Only relevant if individual patient data is available. Defaults to NULL

indiv.events

Event status for each individual (vector or factor). Only relevant if individual patient data is available. Defaults to NULL

indiv.covar

Event status for each individual (vector or factor). Only relevant if individual patient data is available. Defaults to NULL

xlim

The x limits (x1, x2) of the plot. Defaults to c(0, 30)

ylim

The y limits (y1, y2) of the plot. If NULL, ylim will be determined automatically

xlab

A title for the x axis. Defaults to “Time”

ylab

A title for the y axis. Defaults to “CIF”

legend

Adds a legend to the plot. Defaults to TRUE

...

Further arguments for plot

See Also

cif, etm

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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
### Example data.frame with aggregated count data
dat <- data.frame(
			times = c(7948,2899), 
			no.event = c(6,8), 
			event.1 = c(589,68), 
			event.2 = c(55,21), 
			row.names = c("covar0","covar1"))  

### Compute irates object from dat
ir <- irates(dat)

### Compute the cumulative incidence function from irates object
### here: timespan is specified by xlim (default: xlim = c(0,30))
CIFplot(x = ir)


### sir.adm: Individual patient data
data(sir.adm)

### aggregate data
agg.sir.adm <- data.reshape(
			times = sir.adm$time, 
			events = sir.adm$status, 
			covar = sir.adm$pneu, 
			no.event.code= "0")

### Plot parametric and non-parametric CIF estimates
CIFplot(
	x = irates(agg.sir.adm), 
	indiv.times = sir.adm$time, 
	indiv.events = sir.adm$status, 
	indiv.covar = sir.adm$pneu)


### okiss: Individual patient data
### here: e.g. just event of interest 1 (infection) is plotted
data(okiss)

### aggregate data
agg.okiss <- data.reshape(
			times = okiss$time, 
			events = okiss$status, 
			covar = okiss$allo, 
			no.event.code= "11")

### Plot parametric and non-parametric CIF estimates
CIFplot(
	x = irates(agg.okiss), 
	event.code = "1",
	indiv.times = okiss$time, 
	indiv.events = okiss$status, 
	indiv.covar = okiss$allo)

compeir documentation built on May 2, 2019, 5:47 a.m.