Title: | Time-Dependent ROC Curve and AUC for Censored Survival Data |
---|---|
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. |
Authors: | Paul Blanche |
Maintainer: | Paul Blanche <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.4 |
Built: | 2024-11-19 06:12:53 UTC |
Source: | https://github.com/cran/timeROC |
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.
compare(x, y, adjusted = FALSE, abseps = 1e-06)
compare(x, y, adjusted = FALSE, abseps = 1e-06)
x |
An object of class "ipcwsurvivalROC" or "ipcwcompetingrisksROC". The object |
y |
An object of class "ipcwsurvivalROC" or "ipcwcompetingrisksROC". The object |
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 |
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.
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.
Paul Blanche [email protected]
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.
##-------------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)
##-------------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)
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.
## 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, ...)
## 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, ...)
object |
An object of class "ipcwsurvivalROC" or "ipcwcompetingrisksROC". The object |
parm |
Dummy argument. (Not used). |
level |
The confidence level required. Default is |
n.sim |
The number of simulations for computing simultaneous confidence bands. |
... |
Dummy argument. (Not used). |
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.
Without competing risks, a list containing :
CI_AUC
: a matrix. Columns correspond to the lower
and the upper bounds of the pointwise confidence intervals of AUC. Rows
correspond to the time points for which time-dependent AUC estimator was computed.
CB_AUC
: a matrix. Columns correspond to the lower
and the upper bounds of the simultaneous confidence band of the AUC curve. Rows
correspond to the time points for which time-dependent AUC estimator was computed.
C.alpha
: a numeric value corresponding to the quantile
required for simultaneous confidence band computation (estimated by
simulations).
With competing risks, a list containing :
CI_AUC_1
: a matrix. Columns correspond to the lower
and the upper bounds of the pointwise confidence intervals of AUC
with definition (i) of controls. Rows correspond to the time
points for which time-dependent AUC estimator was computed.
CB_AUC_1
: a matrix. Columns correspond to the lower
and the upper bounds of the simultaneous confidence band of the AUC curve
with definition (i) of controls. Rows correspond to the time
points for which time-dependent AUC estimator was computed.
C.alpha.1
: a numeric value corresponding to the quantile
required for simultaneous confidence bands computation CB_AUC_1
(estimated by
simulations).
CI_AUC_2
: a matrix. Columns correspond to the lower
and the upper bounds of the pointwise confidence intervals of AUC
with definition (ii) of controls. Rows correspond to the time
points for which time-dependent AUC estimator was computed.
CB_AUC_2
: a matrix. Columns correspond to the lower
and the upper bounds of the simultaneous confidence band of the AUC curve
with definition (ii) of controls. Rows correspond to the time
points for which time-dependent AUC estimator was computed.
C.alpha.2
: a numeric value corresponding to the quantile
required for simultaneous confidence band computation CB_AUC_2
(estimated by
simulations).
For AUC definitions (i) and (ii), see details about timeROC
function.
Paul Blanche [email protected]
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.
timeROC
, compare
, plotAUCcurve
, plotAUCcurveDiff
##-------------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)
##-------------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)
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.
data(Melano)
data(Melano)
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).
http://192.38.117.59/~linearpredictors/?page=datasets&dataset=Melano
Regression with linear predictors (2010)
Andersen, P.K. and Skovgaard, L.T.
Springer Verlag
data(Melano) head(Melano)
data(Melano) head(Melano)
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.
data(Paquid)
data(Paquid)
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.
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.
data(Paquid) head(Paquid)
data(Paquid) head(Paquid)
This function plots time-dependent ROC curve estimate.
## 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, ...)
## 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, ...)
x |
An object of class "ipcwcompetingrisksROC". The object |
FP |
A numeric value that indicates which definition of controls the ROC
curve is plotted in the competing risks setting. |
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 |
add |
A logical value that indicates if you only want to add the ROC curve estimate to a pre-existing plot. Default is |
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 |
... |
Arguments to be passed to plot method. (See |
Paul Blanche [email protected]
##-------------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)
##-------------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)
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.
plotAUCcurve(object, FP = 2, add = FALSE, conf.int = FALSE, conf.band = FALSE, col = "black")
plotAUCcurve(object, FP = 2, add = FALSE, conf.int = FALSE, conf.band = FALSE, col = "black")
object |
An object of class "ipcwsurvivalROC" or "ipcwcompetingrisksROC"
previously estimated from the |
FP |
In the competing risks setting, a numeric value that indicates which
definition of AUC is plotted. |
add |
A logical value that indicates if you want to add the AUC curve to a pre-existing plot. Default is |
conf.int |
A logical value that indicates whether or not you want to plot the bands
of pointwise confidence intervals. Default is |
conf.band |
A logical value that indicates whether or not you want to plot the simultaneous confidence bands. Default is |
col |
The color to plot the AUC curve. Default is |
Paul Blanche [email protected]
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
confint
for confidence intervals and confidence bands computation of time-dependentAUC.
plotAUCcurveDiff
for plotting the curve of the
difference of two time-dependent AUCs over time
with eventually confidence intervals and
simultaneous confidence bands.
## 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)
## 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)
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.
plotAUCcurveDiff(object1, object2, FP = 2, add = FALSE, conf.int = FALSE, conf.band = FALSE, col = "black", ylim = c(-0.5, 0.5))
plotAUCcurveDiff(object1, object2, FP = 2, add = FALSE, conf.int = FALSE, conf.band = FALSE, col = "black", ylim = c(-0.5, 0.5))
object1 |
An object of class "ipcwsurvivalROC" or "ipcwcompetingrisksROC"
previously estimated from the |
object2 |
An object of class "ipcwsurvivalROC" or "ipcwcompetingrisksROC"
previously estimated from the |
FP |
In the competing risks setting, a numeric value that indicates which
definition of AUC is plotted. |
add |
A logical value that indicates if you want to add the AUC curve to a pre-existing plot. Default is |
conf.int |
A logical value that indicates whether or not you want to plot the bands
of pointwise confidence intervals. Default is |
conf.band |
A logical value that indicates whether or not you want to plot the simultaneous confidence bands. Default is |
col |
The color to plot the AUC curve. Default is |
ylim |
The range of the y-axis. Default is |
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.
The two markers evluated in objects object1
and
object2
must have been measured on the same subjects.
Paul Blanche [email protected]
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
confint
for confidence intervals and confidence bands computation of time-dependentAUC.
plotAUCcurve
for plotting the curve of time-dependent-AUC: AUC(t) versus t. Confidence intervals and simultaneous confidence bands can also be plotted.
## 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)
## 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)
Printing of objects created with the timeROC function
## 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, ...)
## 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, ...)
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 |
digits |
The number of significant digits. Default value is |
... |
Not used. |
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 :
observed cases: subjects for which we know they undergo the (main) event prior the time "t" of interest.
survivors : event-free subjects at time "t" of interest.
censored subjects : censored subjects prior the time "t" of interest, for which we cannot know if they undergo an event or not prior time "t" (and so for which we cannot know if they are cases or controls at time "t").
other events: (in the competing risks setting only) subjects for which we know that they undergo an event different from the main event prior the time "t" of interest.
Furthermore, the function recalls the method used to compute the inverse probability of censoring weights.
Paul Blanche [email protected]
##-------------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)
##-------------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)
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.
SeSpPPVNPV(cutpoint, T, delta, marker, other_markers = NULL, cause, weighting = "marginal", times, iid = FALSE)
SeSpPPVNPV(cutpoint, T, delta, marker, other_markers = NULL, cause, weighting = "marginal", times, iid = FALSE)
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
|
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 |
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 |
weighting |
The method used to compute the weights. |
times |
The vector of times points "t" at which we want to compute the
time-dependent ROC curve. If vector |
iid |
A logical value that indicates if we want to compute the
iid-representation of the area under time-dependent ROC curve
estimator. |
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 denote the event time of the subject
.
Without competing risks : A case is defined as a subject with
. A control is defined as a subject
with
.
With competing risks : In this setting, subjects may undergo different type of events, denoted by in the following. Let suppose that we are interested in the event
. Then, a case is defined as a subject
with
and
.
With competing risks, two definitions of controls were suggested: (i) a control is defined as a subject
that is free of any event, i.e with
, and (ii) a control is defined as a subject
that is not a case, i.e with
or with
and
.
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) .
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" :
TP
: vector of time-dependent True Positive fraction
(sensitivity) estimates at each time points.
FP
: vector of time-dependent False Positive fraction
(1-specificity) estimates at each time points.
PPV
: vector of time-dependent Positive Predictive Value
estimates at each time points.
NPV
: vector of time-dependent Negative Predictive Value
estimates at each time points.
Specific objects of class "ipcwcompetingrisksSeSpPPVNPV" :
TP
: vector of time-dependent True Positive fraction
(sensitivity) estimates at each time points.
FP_1
: vector of time-dependent False Positive fraction
(1-specificity) estimates at each time points with definition
(i) of controls (see Details).
FP_2
: vector of time-dependent False Positive fraction
(1-specificity) estimates at each time points with definition
(ii) of controls (see Details).
PPV_1
: vector of time-dependent Positive Predictive Value
estimates at each time points with definition
(i) of controls (see Details).
NPV_2
: vector of time-dependent Negative Predictive Value
estimates at each time points with definition
(ii) of controls (see Details).
Objects common to both classes :
times
: the time points for which Se, Sp,
PPV, etc.. were computed.
cutpoint
: the cutpoint for which Se, Sp,
PPV, etc.. were computed.
weights
: a object of class "IPCW", containing all informations about the weights. See ipcw
function of pec
package.
computation_time
: the total computation time.
Stats
: a matrix containing descriptive statistics at each time points (like numbers of observed cases or censored observations before each time points).
iid
: the logical value of parameter iid
used in argument.
n
: the sample size, after having omitted missing vaues.
inference
: a list that contains, among other things, iid-representations and estimated standard errors of the estimators.
computation_time
: the computation time, in seconds.
Paul Blanche [email protected]
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.
##-------------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
##-------------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
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.
timeROC(T, delta, marker, other_markers = NULL, cause, weighting = "marginal", times, ROC = TRUE, iid = FALSE)
timeROC(T, delta, marker, other_markers = NULL, cause, weighting = "marginal", times, ROC = TRUE, iid = FALSE)
T |
The vector of (censored) event-times. |
delta |
The vector of event indicators at the corresponding value of the vector |
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 |
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 |
weighting |
The method used to compute the weights. |
times |
The vector of times points "t" at which we want to compute the time-dependent ROC curve. If vector |
ROC |
A logical value that indicates if we want to save the estimates of
sensitivities and specificties. Default value is |
iid |
A logical value that indicates if we want to compute the iid-representation of the area under time-dependent ROC curve estimator. |
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 denote the event time of the subject
.
Without competing risks : A case is defined as a subject with
. A control is defined as a subject
with
.
With competing risks : In this setting, subjects may undergo different type of events, denoted by in the following. Let suppose that we are interested in the event
. Then, a case is defined as a subject
with
and
.
With competing risks, two definitions of controls were suggested: (i) a control is defined as a subject
that is free of any event, i.e with
, and (ii) a control is defined as a subject
that is not a case, i.e with
or with
and
.
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) .
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" :
AUC
: vector of time-dependent AUC estimates at each time points.
TP
: matrix of time-dependent True Positive fraction (sensitivity) estimates.
FP
: matrix of time-dependent False Positive fraction (1-specificity) estimates.
Specific objects of class "ipcwcompetingrisksROC" :
AUC_1
: vector of time-dependent AUC estimates at each time points with definition (i) of controls (see Details).
AUC_2
: vector of time-dependent AUC estimates at each time points with definition (ii) of controls (see Details).
TP
: matrix of time-dependent True Positive fraction (sensitivity) estimates.
FP_1
: matrix of time-dependent False Positive fraction (1-specificity) estimates with definition (i) of controls (see Details).
FP_2
: matrix of time-dependent False Positive fraction (1-specificity) estimates with definition (ii) of controls (see Details).
Objects common to both classes :
times
: the time points for which the time-dependent ROC curves were computed.
weights
: a object of class "IPCW", containing all informations about the weights. See ipcw
function of pec
package.
computation_time
: the total computation time.
CumulativeIncidence
: the vector of estimated probabilities of being a case at each time points.
survProb
: the vector of estimated probabilities of being event-free at each time points.
Stats
: a matrix containing descriptive statistics at each time points (like numbers of observed cases or censored observations before each time points).
iid
: the logical value of parameter iid
used in argument.
n
: the sample size, after having omitted missing vaues.
inference
: a list that contains, among other things, iid-representations and estimated standard errors of the estimators, and that is used for computation of comparison tests and confidence intervals.
computation_time
: the computation time, in seconds.
Paul Blanche [email protected]
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.
compare
for testing a difference of time-dependent AUCs.
confint
for confidence intervals of time-dependent AUC.
SeSpPPVNPV
for estimating Sensitivity (Se), Specificity (Sp), Positive Predictive
Value (PPV) and Negative Predictive Value (NPV) at a given cutpoint
marker value.
plot
for plotting time-dependent ROC curves.
plotAUCcurve
for plotting time-dependent AUC curve.
plotAUCcurveDiff
for plotting the curve of the
difference of two time-dependent AUCs over time.
##-------------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)
##-------------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)