plotAUCcurveDiff: Plot the curve of the difference of two time-dependent AUCs...

Description Usage Arguments Details Note Author(s) References See Also Examples

View source: R/plotAUCcurveDiff.R

Description

This function plots the curve of the difference of two time-dependent AUCs over time. Pointwise and simultaneous confidence bands for this curve can also be plotted when inverse probability of censoring weights are computed from a Kaplan-Meier estimator.

Usage

1
2
plotAUCcurveDiff(object1, object2, FP = 2, add = FALSE, conf.int = FALSE,
                 conf.band = FALSE, col = "black", ylim = c(-0.5, 0.5))

Arguments

object1

An object of class "ipcwsurvivalROC" or "ipcwcompetingrisksROC" previously estimated from the timeROC function.

object2

An object of class "ipcwsurvivalROC" or "ipcwcompetingrisksROC" previously estimated from the timeROC function.

FP

In the competing risks setting, a numeric value that indicates which definition of AUC is plotted. 1 for definition (i) and 2 for definition (ii). (See details of timeROC function for definitions (i) and (ii)). Default is FP = 2.

add

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

conf.int

A logical value that indicates whether or not you want to plot the bands of pointwise confidence intervals. Default is conf.int = FALSE. For choosing conf.int = TRUE, the objects object1 and object2 must have been estimated by the timeROC function with arguments weighting="marginal" and iid = TRUE.

conf.band

A logical value that indicates whether or not you want to plot the simultaneous confidence bands. Default is conf.band = FALSE. For choosing conf.band = TRUE, the objects object1 and object2 must have been estimated by the timeROC function with arguments weighting="marginal" and iid = TRUE.

col

The color to plot the AUC curve. Default is col = "black".

ylim

The range of the y-axis. Default is ylim = c(-0.5,0.5).

Details

Simultaneous confidence bands can be of particular interest for testing null hypotheses such as "for all time t within an interval, AUC(t) for both markers are equal", by observing whether or not the zero line is contained within the band.

Note

The two markers evluated in objects object1 and object2 must have been measured on the same subjects.

Author(s)

Paul Blanche pabl@sund.ku.dk

References

Blanche, P., Dartigues, J. F., & Jacqmin-Gadda, H. (2013). Estimating and comparing time-dependent areas under receiver operating characteristic curves for censored event times with competing risks. Statistics in medicine, 32(30), 5381-5397.

Hung, H. and Chiang, C. (2010). Estimation methods for time-dependent AUC with survival data. Canadian Journal of Statistics, 38(1):8-26

See Also

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
## Not run: 
## computation times is roughly 10 seconds

##-------------Without competing risks-------------------
library(survival)
data(pbc)
head(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 for death.
ROC.bili<-timeROC(T=pbc$time,
                  delta=pbc$status,marker=pbc$bili,
                  cause=1,weighting="marginal",
                  times=quantile(pbc$time,probs=seq(0.2,0.8,0.02)),
                  iid=TRUE)
ROC.bili    
# we evaluate bilirubin as a prognostic biomarker for death.
ROC.albumin<-timeROC(T=pbc$time,
                     delta=pbc$status,marker=-pbc$albumin,
                     cause=1,weighting="marginal",
                     times=quantile(pbc$time,probs=seq(0.2,0.8,0.02)),
                     iid=TRUE)
ROC.albumin
# plot AUC curve for albumin and bilirunbin  with pointwise confidence interval
plotAUCcurve(ROC.albumin,conf.int=TRUE,col="red")
plotAUCcurve(ROC.bili,conf.int=TRUE,col="blue",add=TRUE)
legend("bottomright",c("albumin","bilirunbin"),col=c("red","blue"),lty=1,lwd=2)
#plot the curve of the difference of the two time-dependent AUCs over time
plotAUCcurveDiff(ROC.bili,ROC.albumin,conf.int=TRUE,conf.band=TRUE,ylim=c(-0.2,0.5))

##-------------With competing risks-------------------     
data(Melano)
head(Melano)     
# Evaluate tumor thickness as a prognostic biomarker for
# death from malignant melanoma.
ROC.thick<-timeROC(T=Melano$time,delta=Melano$status,
                   marker=Melano$thick,cause=1,
                   times=quantile(Melano$time,probs=seq(0.2,0.8,0.01)),
                   iid=TRUE)
ROC.thick
ROC.age<-timeROC(T=Melano$time,delta=Melano$status,
                   marker=Melano$age,cause=1,
                   times=quantile(Melano$time,probs=seq(0.2,0.8,0.01)),
                   iid=TRUE)
ROC.age
# plot the two AUC curves on the same plot
plotAUCcurve(ROC.thick,FP=2,conf.int=TRUE,col="blue")
plotAUCcurve(ROC.age,FP=2,conf.int=TRUE,col="red",add=TRUE)
legend("bottomright",c("thickness","age"),col=c("blue","red"),lty=1,lwd=2)
# plot the curve of the difference of the two time-dependent AUCs over time
plotAUCcurveDiff(ROC.thick,ROC.age,FP=2,conf.int=TRUE,conf.band=TRUE,col="red")

## End(Not run)

Example output

  id time status trt      age sex ascites hepato spiders edema bili chol
1  1  400      2   1 58.76523   f       1      1       1   1.0 14.5  261
2  2 4500      0   1 56.44627   f       0      1       1   0.0  1.1  302
3  3 1012      2   1 70.07255   m       0      0       0   0.5  1.4  176
4  4 1925      2   1 54.74059   f       0      1       1   0.5  1.8  244
5  5 1504      1   2 38.10541   f       0      1       1   0.0  3.4  279
6  6 2503      2   2 66.25873   f       0      1       0   0.0  0.8  248
  albumin copper alk.phos    ast trig platelet protime stage
1    2.60    156   1718.0 137.95  172      190    12.2     4
2    4.14     54   7394.8 113.52   88      221    10.6     3
3    3.48    210    516.0  96.10   55      151    12.0     4
4    2.54     64   6121.8  60.63   92      183    10.3     4
5    3.53    143    671.0 113.15   72      136    10.9     3
6    3.98     50    944.0  93.00   63       NA    11.0     3
Time-dependent-Roc curve estimated using IPCW  (n=312, without competing risks). 
          Cases Survivors Censored AUC (%)   se
t=999.2      53       249       10   83.96 2.91
t=1412.74    71       206       35   86.65 2.44
t=1839.5     86       156       70   88.03 2.25
t=2444.56    99       106      107   84.70 2.89
t=3039      108        63      141   80.79 3.48

Method used for estimating IPCW:marginal 

Total computation time : 1.87  secs.
Time-dependent-Roc curve estimated using IPCW  (n=312, without competing risks). 
          Cases Survivors Censored AUC (%)   se
t=999.2      53       249       10   75.00 3.83
t=1412.74    71       206       35   75.74 3.56
t=1839.5     86       156       70   76.55 3.28
t=2444.56    99       106      107   79.22 3.18
t=3039      108        63      141   75.18 3.90

Method used for estimating IPCW:marginal 

Total computation time : 2.22  secs.
  time status thick age
1   10      2  6.76  76
2   30      2  0.65  56
3   35      0  1.34  41
4   99      2  2.90  71
5  185      1 12.08  52
6  204      1  4.84  28
Time-dependent-Roc curve estimated using IPCW  (n=205, with competing risks). 
         Cases Survivors Other events Censored AUC_1 (%) se_1 AUC_2 (%) se_2
t=1267.2    33       164            7        1     79.48 4.10     78.48 4.10
t=1698      44       133            9       19     76.88 3.99     76.04 3.96
t=2005      46       102           10       47     75.00 4.20     73.83 4.17
t=2426      52        71           11       71     71.69 4.68     70.67 4.56
t=3204.8    56        41           13       95     68.22 5.61     66.61 5.32

Method used for estimating IPCW:marginal 

Total computation time : 2.9  secs.
Time-dependent-Roc curve estimated using IPCW  (n=205, with competing risks). 
         Cases Survivors Other events Censored AUC_1 (%) se_1 AUC_2 (%) se_2
t=1267.2    33       164            7        1     56.15 5.77     54.87 5.73
t=1698      44       133            9       19     58.86 5.24     56.99 5.19
t=2005      46       102           10       47     62.02 5.22     59.68 5.18
t=2426      52        71           11       71     65.58 5.06     62.24 5.00
t=3204.8    56        41           13       95     68.29 5.38     64.31 5.26

Method used for estimating IPCW:marginal 

Total computation time : 2.81  secs.

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