# NOT RUN {
data(aSAH)
## Basic example
roc1 <- roc(aSAH$outcome, aSAH$s100b)
roc2 <- roc(aSAH$outcome, aSAH$wfns)
var(roc1)
var(roc2)
# We could also write it in one line:
var(roc(aSAH$outcome, aSAH$s100b))
# }
# NOT RUN {
# The latter used Delong. To use bootstrap:
var(roc1, method="bootstrap")
# Decrease boot.n for a faster execution
var(roc1,method="bootstrap", boot.n=1000)
# }
# NOT RUN {
# To use obuchowski:
var(roc1, method="obuchowski")
# }
# NOT RUN {
# Variance of smoothed ROCs:
# Smoothing is re-done at each iteration, and execution is slow
var(smooth(roc1))
# }
# NOT RUN {
# or from an AUC (no smoothing)
var(auc(roc1))
## Test data from Hanley and Hajian-Tilaki, 1997
disease.present <- c("Yes", "No", "Yes", "No", "No", "Yes", "Yes", "No",
"No", "Yes", "No", "No", "Yes", "No", "No")
field.strength.1 <- c(1, 2, 5, 1, 1, 1, 2, 1, 2, 2, 1, 1, 5, 1, 1)
field.strength.2 <- c(1, 1, 5, 1, 1, 1, 4, 1, 2, 2, 1, 1, 5, 1, 1)
roc3 <- roc(disease.present, field.strength.1)
roc4 <- roc(disease.present, field.strength.2)
# Assess the variance:
var(roc3)
var(roc4)
# }
# NOT RUN {
# With bootstrap:
var(roc3, method="bootstrap")
var(roc4, method="bootstrap")
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab