Type: Package
Title: Time-Dependent ROC Curve and AUC for Censored Survival Data
Version: 0.4
Date: 2019-12-18
Author: Paul Blanche
Maintainer: Paul Blanche <paulfblanche@gmail.com>
Description: Estimation of time-dependent ROC curve and area under time dependent ROC curve (AUC) in the presence of censored data, with or without competing risks. Confidence intervals of AUCs and tests for comparing AUCs of two rival markers measured on the same subjects can be computed, using the iid-representation of the AUC estimator. Plot functions for time-dependent ROC curves and AUC curves are provided. Time-dependent Positive Predictive Values (PPV) and Negative Predictive Values (NPV) can also be computed. See Blanche et al. (2013) <doi:10.1002/sim.5958> and references therein for the details of the methods implemented in the package.
Depends: R (≥ 2.9.1)
Imports: pec (≥ 2.4.4), mvtnorm (≥ 1.0-1)
Suggests: survival, timereg
License: GPL-2 | GPL-3 [expanded from: GPL (≥ 2)]
LazyLoad: yes
NeedsCompilation: no
Packaged: 2019-12-18 14:35:44 UTC; paul
Repository: CRAN
Date/Publication: 2019-12-18 16:00:02 UTC

Malignant melanoma data

Description

In the period 1962-77, 205 patients with malignant melanoma (skin cancer) had a radical operation performed at Odense University Hospital, Denmark. All patients were followed until the end of 1977 by which time 134 were still alive while 71 had died (of out whom 57 had died from cancer and 14 from other causes).

The object of the study was to assess the effect of risk factors on survival.

Usage

data(Melano)

Format

A data frame with 205 observations on the following 4 variables.

time

: time in days from operation.

status

: the status indicator : 0 = censored, 1 = death from malignant melanoma and 2 = death from other causes.

thick

: tumour thickness (in 1/100 mm).

age

: age at operation (years).

Source

http://192.38.117.59/~linearpredictors/?page=datasets&dataset=Melano

References

Regression with linear predictors (2010)

Andersen, P.K. and Skovgaard, L.T.

Springer Verlag

Examples

data(Melano)
head(Melano)

Paquid cohort data

Description

PAQUID is a prospective cohort study initiated in 1988 in South Western France to explore functional and cerebral ageing. This sample includes n=2561 subjects. Data contains a time-to-event (minimum between time from enrolment to dementia onset and time from enrolment to death without dementia), a status indicator, and two cognitive scores measured at baseline.

Usage

data(Paquid)

Format

A data frame with 2561 observations on the following 4 variables.

time

: the time-to-event (in years). It is defined as the minimum between time from enrolment to dementia onset and time from enrolment to death without dementia.

status

: the status indicator : 0 = censored, 1 = dementia onset and 2 = death without dementia.

DSST

: score at the Digit Symbol Substitution Score Test measured at baseline. This test explores attention and psychomotor speed.

MMSE

: score at the Mini Mental State Examination measured at baseline. This test is often used as an index of global cognitive performance.

References

Dartigues, J., Gagnon, M., Barberger-Gateau, P., Letenneur, L., Commenges, D., Sauvel, C., Michel, P., and Salamon, R. (1992). The paquid epidemiological program on brain ageing. Neuroepidemiology, 11(1):14–18.

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.

Examples

data(Paquid)
head(Paquid)

Time-dependent Sensitivity (Se), Specificity (Sp), Positive Predictive Value (PPV) and Negative Predictive Value (NPV) estimation

Description

This function aim at estimating time-dependent Sensitivity (Se), Specificity (Sp), Positive Predictive Value (PPV) and Negative Predictive Value (NPV) at a given cutpoint. Standard error computation via iid-representation of the estimator is also implemented.

Usage

SeSpPPVNPV(cutpoint, T, delta, marker, other_markers = NULL, cause,
           weighting = "marginal", times, iid = FALSE)

Arguments

cutpoint

The cutpoint for maker value at which we aim at estimating Se, Sp, PPV and NPV.

T

The vector of (censored) event-times.

delta

The vector of event indicators at the corresponding value of the vector T. Censored observations must be denoted by the value 0.

marker

The vector of the marker values for which we want to compute the time-dependent ROC curves. Without loss of generality, the function assumes that larger values of the marker are associated with higher risks of events. If lower values of the marker are associated with higher risks of events, then reverse the association adding a minus to the marker values.

other_markers

A matrix that contains values of other markers that we want to take into account for computing the inverse probability of censoring weights. The different columns represent the different markers. This argument is optional, and ignored if method="marginal". Default value is other_markers=NULL.

cause

The value of the event indicator that represents the event of interest for which we aim to compute the time-dependent ROC curve. Without competing risks, it must be the value that indicates a non-censored obsevation (usually 1). With competing risks, subjects can undergo different type of events; then, it must be the value corresponding to the event of interest, for which we aim to compute the ROC curve (usually 1 or 2).

weighting

The method used to compute the weights. weighting="marginal" uses the Kaplan-Meier estimator of the censoring distribution. weighting="cox" and weighting="aalen" model the censoring by the Cox model and the additive Aalen model respectively. Default value is weighting="marginal".

times

The vector of times points "t" at which we want to compute the time-dependent ROC curve. If vector times contains only a single value, then value zero is added.

iid

A logical value that indicates if we want to compute the iid-representation of the area under time-dependent ROC curve estimator. iid = TRUE is required for computation of all inference procedures (Confidence intervals or test for comparing AUCs). For large sample size (greater than 2000, say) and/or large length of vector times, the computation of the iid representations might be time-consuming.

Details

This function computes Inverse Probability of Censoring Weighting (IPCW) estimates of Sensitivity (Se), Specificity (Sp), Positive Predictive Value (PPV) and Negative Predictive Value (NPV) for Cumulative/Dynamic definition of cases and controls.

Let T_i denote the event time of the subject i.

Without competing risks : A case is defined as a subject i with T_i \leq t. A control is defined as a subject i with T_i > t.

With competing risks : In this setting, subjects may undergo different type of events, denoted by \delta_i in the following. Let suppose that we are interested in the event \delta_i=1. Then, a case is defined as a subject i with T_i \leq t and \delta_i=1. With competing risks, two definitions of controls were suggested: (i) a control is defined as a subject i that is free of any event, i.e with T_i > t, and (ii) a control is defined as a subject i that is not a case, i.e with T_i > t or with T_i \leq t and \delta_i \neq 1. For all outputs of this package, objects named with _1 refer to definition (i). For instance AUC_1 or se_1 refer to time-dependent area under the ROC curve and its estimated standard error according to the definition (i). Objects named with _2 refer to definition (ii) .

Value

Object of class "ipcwsurvivalSeSpPPVNPV" or "ipcwcompetingrisksSeSpPPVNPV", depending on if there is competing risk or not, that is a list. For these classes, there are print, plot and confint methods. Most objects that they contain are similar, but some are specific to each class.

Specific objects of class "ipcwsurvivalSeSpPPVNPV" :

Specific objects of class "ipcwcompetingrisksSeSpPPVNPV" :

Objects common to both classes :

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.

See Also

timeROC

Examples

##-------------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     
# Se, Sp, PPV and NPV computation for serum bilirunbin at threshold c=0.9(mg/dl) 
res.SeSpPPVNPV.bili <- SeSpPPVNPV(cutpoint=0.9,
                                  T=pbc$time,
                                  delta=pbc$status,marker=pbc$bili,
                                  cause=1,weighting="marginal",
                                  times=quantile(pbc$time,probs=seq(0.2,0.8,0.1)),
                                  iid=TRUE)
res.SeSpPPVNPV.bili

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

#---------Example with Paquid data--------
data(Paquid)
# Se, Sp, PPV and NPV computation for DSST at threshold c=22
res.SeSpPPVNPV.DSST <- SeSpPPVNPV(cutpoint=22,
                                  T=Paquid$time,
                                  delta=Paquid$status,marker=Paquid$DSST,
                                  cause=1,weighting="cox",
                                  times=c(3,5,8,10))
res.SeSpPPVNPV.DSST

#---------Example with Melano data-------
data(Melano)
# Se, Sp, PPV and NPV computation for tumor thickness at threshold c=3 (1/100 mm)
res.SeSpPPVNPV.thick <- SeSpPPVNPV(cutpoint=3,
                                  T=Melano$time,delta=Melano$status,
                                  weighting="marginal",
                                  marker=Melano$thick,cause=1,
                                  times=c(1800,2000,2200),
                                  iid=TRUE)
res.SeSpPPVNPV.thick

Compute tests for comparing two time-dependent AUC

Description

This function computes the p-value for testing the null hypothesis that asserts that two time-dependent AUCs of two markers are equal. The two markers must have been measured on the same subjects.

Usage

compare(x, y, adjusted = FALSE, abseps = 1e-06)

Arguments

x

An object of class "ipcwsurvivalROC" or "ipcwcompetingrisksROC". The object x must have been estimated by the timeROC function with arguments
weighting="marginal" and iid = TRUE.

y

An object of class "ipcwsurvivalROC" or "ipcwcompetingrisksROC". The object y must have been estimated by the timeROC function with arguments
weighting="marginal" and iid = TRUE.

adjusted

A logical value that indicates if we also want to compute adjusted p-values, for accounting for the mutiplicity of tests (as many tests as there are time points for which we have estimated the AUCs of the two markers).

abseps

relative error tolerance as double. This optional technical argument is the argument of function GenzBretz that is used when adjusted = TRUE. Default is 1e-06.

Details

For each time points, the function computes the difference between estimated AUCs of both markers, the variance of the difference using the iid-representation of the AUC estimators, and return the p-value of the comparison test. For each time point "t", the null hypothesis that is tested is : "AUC of both markers are equal at time "t" ". When option adjusted = TRUE is chosen, then the function also computes the adjusted p-values, to account for the fact that we compute as many p-values as there as time points. The computation is based on the fact that (i) the vector of the differences of AUCs are asymptotically normally distributed, and that (ii) the variance-covariance matrix can be consistently estimated using the iid-representations of the AUC estimators at all time points.

Value

The function compare returns a list. The list contains p-values of the comparison tests computed at all time points. If adjusted = TRUE, then it also contains the correlation matrix of the test statistics, that was used to compute adjusted p-values, to account for multiple testing.

Author(s)

Paul Blanche pabl@sund.ku.dk

References

Chiang CT, Hung H.(2010). Non-parametric estimation for time-dependent AUC. Journal of Statistical Planning and Inference, 140:1162-1174.

Bretz, F., Hothorn, T., and Westfall, P. (2010). Multiple comparisons using R. Chapman \& Hall/CRC.

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.

See Also

timeROC, confint

Examples

##-------------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. 
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.1)),
                  iid=TRUE)

# we evaluate albumin as a prognostic biomarker.
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.1)),
                  iid=TRUE)

# we compare albumin and bilirubin as prognostic biomarkers.
ROC.albumin #print results for albumin
ROC.bili    #print results for bilirubin
compare(ROC.albumin,ROC.bili) #compute p-values of comparison tests
compare(ROC.albumin,ROC.bili,adjusted=TRUE)

##-------------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.2)),
                   iid=TRUE)

# Evaluate age at operation as a prognostic tool for
# death from malignant melanoma.
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.2)),
                 ROC=TRUE,iid=TRUE)

# compare the predictive abilities of tumor thickness and 
# age at operation for death from malignant melanoma.
ROC.thick
ROC.age
compare(ROC.age,ROC.thick,adjusted=TRUE)



## Not run: 
	data(Paquid)
	head(Paquid)

	# Computation requires approximately   1 minute 
	# (because n=2561 subjects, iid=TRUE, and times=c(3,5,10))
	# 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,
        		          times=c(3,5,10),ROC=TRUE,iid=TRUE)
	ROC.DSST

	# Computation requires approximately   1 minute 
	# (because n=2561 subjects, iid=TRUE, and times=c(3,5,10))
	# evaluate MMSE cognitive score as a prognostic tool for
	# dementia onset, accounting for death without dementia competing risk.
	ROC.MMSE<-timeROC(T=Paquid$time,delta=Paquid$status,
    		              marker=-Paquid$MMSE,cause=1,
        		          times=c(3,5,10),ROC=TRUE,iid=TRUE)
	
	# we compare MMSE and DSST cognitive tests as prognostic tools
	# for dementia, accounting for death without dementia competing risk.
	ROC.DSST
	ROC.MMSE
	compare(ROC.DSST,ROC.MMSE,adjusted=TRUE)

## End(Not run)




Confidence intervals for areas under time-dependent ROC curves

Description

This function computes pointwise confidence interval and simultaneous confidence bands for areas under time-dependent ROC curves (time-dependent AUC). Pointwise confidence intervals and simultaneous confidence bands are computed from the asymptotic normality of time-dependent AUC estimators. Standard errors are estimated from the iid-representation of the estimator. The method is at present only implemented for inverse probability of censoring weights computed from a Kaplan-Meier estimator.

Usage

## S3 method for class 'ipcwsurvivalROC'
confint(object, parm=NULL, level = 0.95,n.sim=2000, ...)
## S3 method for class 'ipcwcompetingrisksROC'
confint(object, parm=NULL, level = 0.95,n.sim=2000, ...)

Arguments

object

An object of class "ipcwsurvivalROC" or "ipcwcompetingrisksROC". The object object must have been estimated by the timeROC function with arguments weighting="marginal" and iid = TRUE.

parm

Dummy argument. (Not used).

level

The confidence level required. Default is 0.95.

n.sim

The number of simulations for computing simultaneous confidence bands.

...

Dummy argument. (Not used).

Details

Time-dependent AUC estimators are asymptotically normally distributed. Then, confidence intervals are computed using an estimate of the variance and the quantiles of the standard normal distribution. To compute the variance estimates, the function computes the empirical variance estimates of the estimated iid-representations of the time-dependent AUC estimators. A simulation technique is used for computing appropriate quantiles of simultaneous confidence bands.

Value

Without competing risks, a list containing :

With competing risks, a list containing :

For AUC definitions (i) and (ii), see details about timeROC function.

Author(s)

Paul Blanche pabl@sund.ku.dk

References

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

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.

See Also

timeROC, compare, plotAUCcurve, plotAUCcurveDiff

Examples

##-------------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.1)),
                  iid=TRUE)
ROC.bili
confint(ROC.bili)


##-------------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.2)),
                   iid=TRUE)
ROC.thick
confint(ROC.thick)

## Not run: 
	data(Paquid)
	head(Paquid)
	
	# Computation requires approximately 30 seconds 
	# (because iid=TRUE and n=2561 subjects)	
	# 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="marginal",times=c(3,5),
                      ROC=TRUE,iid=TRUE)
	ROC.DSST
	confint(ROC.DSST)

## End(Not run) 

Plot function for time-dependent ROC curve

Description

This function plots time-dependent ROC curve estimate.

Usage

## 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

##-------------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)

Plot time-dependent AUC curve

Description

This function plots the curve of time-dependent-AUC: AUC(t) versus t. 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

plotAUCcurve(object, FP = 2, add = FALSE, conf.int = FALSE,
             conf.band = FALSE, col = "black")

Arguments

object

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 object object 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 object object 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".

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


## 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 only with pointwise confidence intervals
# and simultaneous confidence bands
plotAUCcurve(ROC.albumin,conf.int=TRUE,conf.band=TRUE)
# plot AUC curve for albumin and bilirunbin  with pointwise confidence intervals
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)


##-------------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
# plot AUC curve for tumor thickness with pointwise confidence intervals
# and simultaneous confidence bands
plotAUCcurve(ROC.thick,FP=2,conf.int=TRUE,conf.band=TRUE)

## End(Not run)

Plot the curve of the difference of two time-dependent AUCs over time

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

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

## 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)

Print objects in the timeROC library

Description

Printing of objects created with the timeROC function

Usage

## S3 method for class 'ipcwsurvivalROC'
print(x, No.lines=5,digits=2, ...)
## S3 method for class 'ipcwcompetingrisksROC'
print(x, No.lines=5,digits=2, ...)
## S3 method for class 'ipcwsurvivalSeSpPPVNPV'
print(x, No.lines=5,digits=2, ...)
## S3 method for class 'ipcwcompetingrisksSeSpPPVNPV'
print(x, No.lines=5,digits=2, ...)

Arguments

x

Object of class "ipcwsurvivalROC", "ipcwcompetingrisksROC", "ipcwsurvivalSeSpPPVNPV" or "ipcwcompetingrisksSeSpPPVNPV".

No.lines

The (maximum) number of lines printed. Each line corresponds to a time point included in the vector times of the object x. For example, if No.lines=5, then the function chooses the five time points corresponding to the quantiles of the vector times of the object x. If No.lines=10, it chooses the deciles, etc...

digits

The number of significant digits. Default value is digits = 2.

...

Not used.

Details

The print function recalls the sample size (after having removed missing data), the AUC estimates, and the estimated standard errors (only if they have been estimated) for at maximum No.lines time points. In addition, it displays the frequencies of :

Furthermore, the function recalls the method used to compute the inverse probability of censoring weights.

Author(s)

Paul Blanche pabl@sund.ku.dk

See Also

timeROC, SeSpPPVNPV

Examples

##-------------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

ROC.bili.cox<-timeROC(T=pbc$time,
                      delta=pbc$status,marker=pbc$bili,
                      other_markers=as.matrix(pbc[,c("chol","albumin")]),
                      cause=1,weighting="cox",
                      times=quantile(pbc$time,probs=seq(0.2,0.8,0.01)))

# prints descriptive statistics and AUC estimates (5,10 and 20 lines)
print(ROC.bili.cox)
print(ROC.bili.cox,No.lines=10)
print(ROC.bili.cox,No.lines=20,digits=1)

# Se, Sp, PPV and NPV computation for serum bilirunbin at threshold c=0.9(mg/dl) 
res.SeSpPPVNPV.bili <- SeSpPPVNPV(cutpoint=0.9,
                                  T=pbc$time,
                                  delta=pbc$status,marker=pbc$bili,
                                  other_markers=as.matrix(pbc[,c("chol","albumin")]),
                                  cause=1,weighting="cox",
                                  times=quantile(pbc$time,probs=seq(0.2,0.8,0.1)))

# prints descriptive statistics and Se, Sp, PPV and NPV
#  estimates for serum bilirunbin at threshold c=0.9(mg/dl) 
print(res.SeSpPPVNPV.bili,No.lines=20,digits=1)

ROC.bili.marginal<-timeROC(T=pbc$time,
                           delta=pbc$status,marker=pbc$bili,
                           cause=1,weighting="marginal",
                           times=quantile(pbc$time,probs=seq(0.1,0.9,0.2)),
                           iid=TRUE)

# prints descriptive statistics, AUC estimates and also standard errors
# of AUCs because weighting="marginal" and iid=TRUE were used.
print(ROC.bili.marginal)

##-------------With competing risks-------------------
data(Melano)
ROC.thick<-timeROC(T=Melano$time,delta=Melano$status,
                   marker=Melano$thick,cause=1,
                   weighting="marginal",
                   times=c(1500,2000,2500),iid=TRUE)

# prints descriptive statistics, AUC estimates and also standard errors
# of AUCs because weighting="marginal" and iid=TRUE were used.
print(ROC.thick)


# Se, Sp, PPV and NPV computation for tumor thickness at
#threshold c=3 (1/100 mm)
res.SeSpPPVNPV.thick <- SeSpPPVNPV(cutpoint=3,
                                  T=Melano$time,delta=Melano$status,
                                  weighting="marginal",
                                  marker=Melano$thick,cause=1,
                                  times=c(1800,2000,2200),
                                  iid=TRUE)
print(res.SeSpPPVNPV.thick,digits=1)

Time-dependent ROC curve estimation

Description

Inverse Probability of Censoring Weighting (IPCW) estimation of Cumulative/Dynamic time-dependent ROC curve. The function works in the usual survival setting as well as in the competing risks setting. Computation of the iid-representation of areas under time-dependent ROC curves is implemented. This enables computation of inference procedures: Confidence intervals and tests for comparing two AUCs of two different markers measured on the same subjects.

Usage

timeROC(T, delta, marker, other_markers = NULL, cause,
	    weighting = "marginal", times, ROC = TRUE, iid = FALSE)

Arguments

T

The vector of (censored) event-times.

delta

The vector of event indicators at the corresponding value of the vector T. Censored observations must be denoted by the value 0.

marker

The vector of the marker values for which we want to compute the time-dependent ROC curves. Without loss of generality, the function assumes that larger values of the marker are associated with higher risks of events. If lower values of the marker are associated with higher risks of events, then reverse the association adding a minus to the marker values.

other_markers

A matrix that contains values of other markers that we want to take into account for computing the inverse probability of censoring weights. The different columns represent the different markers. This argument is optional, and ignored if method="marginal". Default value is other_markers=NULL.

cause

The value of the event indicator that represents the event of interest for which we aim to compute the time-dependent ROC curve. Without competing risks, it must be the value that indicates a non-censored obsevation (usually 1). With competing risks, subjects can undergo different type of events; then, it must be the value corresponding to the event of interest, for which we aim to compute the ROC curve (usually 1 or 2).

weighting

The method used to compute the weights. weighting="marginal" uses the Kaplan-Meier estimator of the censoring distribution. weighting="cox" and weighting="aalen" model the censoring by the Cox model and the additive Aalen model respectively. Default value is weighting="marginal".

times

The vector of times points "t" at which we want to compute the time-dependent ROC curve. If vector times contains only a single value, then value zero is added.

ROC

A logical value that indicates if we want to save the estimates of sensitivities and specificties. Default value is ROC = TRUE.

iid

A logical value that indicates if we want to compute the iid-representation of the area under time-dependent ROC curve estimator. iid = TRUE is required for computation of all inference procedures (Confidence intervals or test for comparing AUCs). For large sample size (greater than 2000, say) and/or large length of vector times, the computation of the iid representations might be time-consuming. Default value is iid = FALSE.

Details

This function computes Inverse Probability of Censoring Weighting (IPCW) estimates of Cumulative/Dynamic time-dependent ROC curve. By definition, time-dependent ROC curve intrinsically depends on the definitions of time-dependent cases and controls.
Let T_i denote the event time of the subject i.

Without competing risks : A case is defined as a subject i with T_i \leq t. A control is defined as a subject i with T_i > t.

With competing risks : In this setting, subjects may undergo different type of events, denoted by \delta_i in the following. Let suppose that we are interested in the event \delta_i=1. Then, a case is defined as a subject i with T_i \leq t and \delta_i=1. With competing risks, two definitions of controls were suggested: (i) a control is defined as a subject i that is free of any event, i.e with T_i > t, and (ii) a control is defined as a subject i that is not a case, i.e with T_i > t or with T_i \leq t and \delta_i \neq 1. For all outputs of this package, objects named with _1 refer to definition (i). For instance AUC_1 or se_1 refer to time-dependent area under the ROC curve and its estimated standard error according to the definition (i). Objects named with _2 refer to definition (ii) .

Value

Object of class "ipcwsurvivalROC" or "ipcwcompetingrisksROC", depending on if there is competing risk or not, that is a list. For these classes, there are print, plot and confint methods. Most objects that they contain are similar, but some are specific to each class.

Specific objects of class "ipcwsurvivalROC" :

Specific objects of class "ipcwcompetingrisksROC" :

Objects common to both classes :

Author(s)

Paul Blanche pabl@sund.ku.dk

References

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

Uno, H., Cai, T., Tian, L. and Wei, L. (2007). Evaluating prediction rules for t-years survivors with censored regression models. Journal of the American Statistical Association, 102(478):527-537.

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.

P. Blanche, A. Latouche, V. Viallon (2013). Time-dependent AUC with right-censored data: A Survey. Risk Assessment and Evaluation of Predictions, 239-251, Springer, http://arxiv.org/abs/1210.6805.

See Also

Examples

##-------------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.

# 1) with the Kaplan-Meier estimator for computing the weights (default).
ROC.bili.marginal<-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.1)),
                  iid=TRUE)
ROC.bili.marginal

# 2) with a Cox model (with covariates bili, chol and albumin) for computing the weights.
ROC.bili.cox<-timeROC(T=pbc$time,
                      delta=pbc$status,marker=pbc$bili,
                      other_markers=as.matrix(pbc[,c("chol","albumin")]),
                      cause=1,weighting="cox",
                      times=quantile(pbc$time,probs=seq(0.2,0.8,0.1)))
ROC.bili.cox

##-------------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))
ROC.thick

#---------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)
ROC.DSST 
plot(ROC.DSST,time=5)