# 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)
# }
Run the code above in your browser using DataLab