Learn R Programming

ROCt (version 0.8)

net.ROCt: Net time-dependent ROC curves with right censored data

Description

This function performs the characteristics of a net time-dependent ROC curve based on k-nearest neighbor's (knn) estimator or only based on the Pohar-Perme estimator (Pohar, 2012).

Usage

net.ROCt(times, failures, variable, p.age, p.sex, p.year,
 rate.table, pro.time, cut.off, knn=FALSE,
 lambda=NULL)

Arguments

times
A numeric vector with the follow up times.
failures
A numeric vector with the event indicator (0=right censored, 1=event).
variable
A numeric vector with the prognostic variable. This variable is collected at the baseline.
p.age
A numeric vector with the age of the individuals at the baseline (in days).
p.sex
A character vector with the gender the individuals ('male' or 'female').
p.year
A numeric vector with the calendar year at the baseline (number of days from the January 1, 1960).
rate.table
A ratetable object with the expected mortality rates by age, sex, and cohort year. The same units used in p.age, p.sex, p.year
pro.time
The value of prognostic time represents the maximum delay for which the capacity of the variable is evaluated. The same unit than the one used in the argument time.
cut.off
The cut-off value(s) of the variable used to define the binary test(s).
knn
A logical value indicating whether k-nearest neighbor's estimator should be used.
lambda
This is the proportion of the nearest neighbors. The estimation will be based on 2*lambda (1 lambda on the left and 1 lambda on the right) of the total sample size.

Value

  • tableThis data frame presents the sensitivities and specificities associated with the cut-off values. One can observe NA if the value cannot be computed.
  • aucThe area under the time-dependent ROC curve for a prognostic up to prognostic time.
  • missingNumber of deleted observations due to missing data.
  • warningThis message indicates possible difficulties in the computation of the net ROC curve, for instance if the net survival was not lower or equal1 to 1 for particular cut-off values or times.

Details

This function computes net time-dependent ROC curve with right-censoring data using estimator defined by Pohar-Perm et al. (2011) and the k-nearest neighbor's (knn) estimator. The aim is to evaluate the capacity of a variable (measured at the baseline) to predict the excess of mortality of a studied population compared to the general population mortality. Using the knn estimator ensures a monotone and increasing ROC curve, but the computation time may be long. This approach may thus be avoided if the sample size is large because of computing time.

References

Pohar M., Stare J., Esteve J. (2012) On Estimation in Relative Survival. Biometrics, 68, 113-120. Lorent M., Giral M., Foucher Y. (2013) Net time-dependent ROC curves: a solution for evaluating the accuracy of a marker to predict disease-related mortality. Statistics in Medicine. In press.

Examples

Run this code
# import the observed data

data(dataDIVAT)

# A subgroup analysis to reduce the time needed for this exemple

dataDIVAT <- dataDIVAT[1:400,]

# import the expected mortality rates

data(fr.ratetable)

# the values of recipient age used for computing 
# the sensibilities and specificities
# (choose more values in practice)

age.cut <- quantile(dataDIVAT$ageR, probs=seq(0.0, 1.0, by=0.2))

# recoding of the variables for matching with the ratetable

dataDIVAT$sex <- "male"
dataDIVAT$sex[dataDIVAT$sexeR==0] <- "female"
dataDIVAT$year <- mdy.date(month=01, day=01, year=dataDIVAT$year.tx,
 nineteen = TRUE, fillday = FALSE, fillmonth = FALSE)
dataDIVAT$age <- dataDIVAT$ageR*365

# the ROC curve (with the knn correction) to predict the
# mortality excess up to the 3000 days.

roc1 <- net.ROCt(times=dataDIVAT$death.time,
 failures=dataDIVAT$death,  variable=dataDIVAT$ageR,
 p.age=dataDIVAT$age, p.sex=dataDIVAT$sex, p.year=dataDIVAT$year,
 rate.table=fr.ratetable, pro.time=3000, cut.off=age.cut, knn=TRUE,
 lambda=0.05)
 
# the sensibilities and specificities associated with the cut off values

roc1$table

# the ROC curve (without the knn correction) to predict the
# mortality excess up to the 3000 days.

roc2 <- net.ROCt(times=dataDIVAT$death.time,
 failures=dataDIVAT$death,  variable=dataDIVAT$ageR,
 p.age=dataDIVAT$age, p.sex=dataDIVAT$sex, p.year=dataDIVAT$year,
 rate.table=fr.ratetable, pro.time=3000, cut.off=age.cut, knn=FALSE,
 lambda=NULL)

# the traditional ROC graph

plot(c(1,1-roc1$table$sp,0), c(1,roc1$table$se,0), ylim=c(0,1),
 xlim=c(0,1), ylab="sensitivity", xlab="1-specificity", type="l",
 col=2, lwd=2, lty=1)
lines(c(1,1-roc2$table$sp,0), c(1,roc2$table$se,0), type="l",
 col=4, lwd=2, lty=2)
 
abline(c(0,0), c(1,1), lty=2)

legend("bottomright", c(
paste("With knn, (AUC=", round(roc1$auc, 2), ")", sep=""),
paste("Without knn, (AUC=", round(roc2$auc, 2), ")", sep="")),
lty=1:2, lwd=c(2,2), col=c(2,4))

Run the code above in your browser using DataLab