plot: Plot function for time-dependent ROC curve

Description Usage Arguments Author(s) See Also Examples

Description

This function plots time-dependent ROC curve estimate.

Usage

1
2
3
4
## S3 method for class 'ipcwsurvivalROC'
plot(x, time, col = "red", add = FALSE, title = TRUE, ...)
## S3 method for class 'ipcwcompetingrisksROC'
plot(x, FP = 2, time, col = "red", add = FALSE, title = TRUE, ...)

Arguments

x

An object of class "ipcwcompetingrisksROC". The object x must have been estimated by the timeROC function with argument ROC = TRUE (default argument).

FP

A numeric value that indicates which definition of controls the ROC curve is plotted in the competing risks setting. 1 for definition (i) and 2 for definition (ii). See details of timeROC function for definitions (i) and (ii). Default is FP = 2 and this argument is ignored when there is no competing risks.

time

A numeric value that indicates the time point at which the ROC curve is plotted.

col

The color to plot the ROC curve. Default is col = "red".

add

A logical value that indicates if you only want to add the ROC curve estimate to a pre-existing plot. Default is add = FALSE.

title

A logical value that indicates if you want to add a generic title, that indicates the chosen time point and the AUC estimate. Default is title = TRUE.

...

Arguments to be passed to plot method. (See plot).

Author(s)

Paul Blanche pabl@sund.ku.dk

See Also

timeROC

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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
##-------------Without competing risks----------------
library(survival)
data(pbc)
pbc<-pbc[!is.na(pbc$trt),] # select only randomised subjects
pbc$status<-as.numeric(pbc$status==2) # create event indicator: 1 for death, 0 for censored

# we evaluate bilirubin as a prognostic biomarker
#(weights computed using an additive Aalen model 
# with covariates bili, chol and albumin). 
library(timereg)
ROC.bili.aalen<-timeROC(T=pbc$time,
                      delta=pbc$status,marker=pbc$bili,
                      other_markers=as.matrix(pbc[,c("chol","albumin")]),
                      cause=1,weighting="aalen",
                      times=c(1800,2000,2200))
#print estimates
ROC.bili.aalen
#plot the ROC curve  at time t=2000
plot(ROC.bili.aalen,time=2000)

# we evaluate albumin and  cholesterol as a prognostic biomarker.
#(weights computed using an additive Aalen model
# with covariates bili, chol and albumin).
ROC.albu.aalen<-timeROC(T=pbc$time,
                        delta=pbc$status,marker=-pbc$albumin,
                        other_markers=as.matrix(pbc[,c("chol","bili")]),
                        cause=1,weighting="aalen",
                        times=c(1800,2000,2200))

ROC.chol.aalen<-timeROC(T=pbc$time,
                        delta=pbc$status,marker=pbc$chol,
                        other_markers=as.matrix(pbc[,c("bili","albumin")]),
                        cause=1,weighting="aalen",
                        times=c(1800,2000,2200))
# print estimates
ROC.albu.aalen
ROC.chol.aalen

# plot all ROC curves at time t=2000
plot(ROC.bili.aalen,time=2000,lwd=2,title=FALSE)
plot(ROC.albu.aalen,time=2000,col="blue",add=TRUE,lwd=2,lty=2)
plot(ROC.chol.aalen,time=2000,col="black",add=TRUE,lwd=2,lty=3)
# add legend
legend("bottomright",c("bilirubin","albumin","cholesterol"),
       col=c("red","blue","black"),lty=1:3)



##-------------With competing risks-------------------

#---------Example with Melano data------------- 
data(Melano)

# Evaluate tumor thickness as a prognostic biomarker for
# death from malignant melanoma.
ROC.thick<-timeROC(T=Melano$time,delta=Melano$status,
                   weighting="aalen",
                   marker=Melano$thick,cause=1,
                   times=c(1800,2000,2200))
plot(ROC.thick,time=1800)

#---------Example with Paquid data------------- 
data(Paquid)

# evaluate DDST cognitive score as a prognostic tool for
# dementia onset, accounting for death without dementia competing risk.
ROC.DSST<-timeROC(T=Paquid$time,delta=Paquid$status,
                  marker=-Paquid$DSST,cause=1,
                  weighting="cox",
                  other_markers=as.matrix(Paquid$MMSE),
                  times=c(3,5,10),ROC=TRUE)

# we compare MMSE and DSST cognitive tests as prognostic tools
# for dementia, accounting for death without dementia competing risk.
ROC.MMSE<-timeROC(T=Paquid$time,delta=Paquid$status,
                  marker=-Paquid$MMSE,cause=1,
                  weighting="cox",
                  other_markers=as.matrix(Paquid$DSST),
                  times=c(3,5,10),ROC=TRUE)

plot(ROC.DSST,time=5,title=FALSE,lwd=2)
plot(ROC.MMSE,time=5,col="blue",add=TRUE,title=FALSE,lwd=2)
legend("right",c("DSST","MMSE"),col=c("red","blue"),lwd=2)

Example output

Time-dependent-Roc curve estimated using IPCW  (n=284, without competing risks). 
       Cases Survivors Censored AUC (%)
t=1800    75       143       66   87.61
t=2000    78       127       79   87.80
t=2200    82       116       86   85.80

Method used for estimating IPCW:aalen 

Total computation time : 0.05  secs.
Time-dependent-Roc curve estimated using IPCW  (n=284, without competing risks). 
       Cases Survivors Censored AUC (%)
t=1800    75       143       66   75.51
t=2000    78       127       79   76.39
t=2200    82       116       86   74.66

Method used for estimating IPCW:aalen 

Total computation time : 0.43  secs.
Time-dependent-Roc curve estimated using IPCW  (n=284, without competing risks). 
       Cases Survivors Censored AUC (%)
t=1800    75       143       66   59.04
t=2000    78       127       79   60.18
t=2200    82       116       86   59.92

Method used for estimating IPCW:aalen 

Total computation time : 0.02  secs.

timeROC documentation built on Dec. 25, 2019, 9:06 a.m.

Related to plot in timeROC...