data(aSAH)
# Syntax (response, predictor):
ci.auc(aSAH$outcome, aSAH$s100b)
# With a roc object:
rocobj <- roc(aSAH$outcome, aSAH$s100b)
# default values
ci.auc(rocobj)
ci(rocobj)
ci(auc(rocobj))
ci(rocobj$auc)
ci(rocobj$auc, method="delong")
# Partial AUC and customized bootstrap:
ci.auc(aSAH$outcome, aSAH$s100b,
boot.n=100, conf.level=0.9, stratified=FALSE, partial.auc=c(1, .8),
partial.auc.focus="se", partial.auc.correct=TRUE)
# Note that the following will NOT give a CI of the partial AUC:
ci.auc(rocobj, boot.n=500, conf.level=0.9, stratified=FALSE,
partial.auc=c(1, .8), partial.auc.focus="se", partial.auc.correct=TRUE)
# This is because rocobj$auc is not a partial AUC.
# You can overcome this problem with reuse.auc:
ci.auc(rocobj, boot.n=500, conf.level=0.9, stratified=FALSE,
partial.auc=c(1, .8), partial.auc.focus="se", partial.auc.correct=TRUE,
reuse.auc=FALSE)
# Alternatively, you can get the CI directly from roc():
rocobj <- roc(aSAH$outcome, aSAH$s100b, ci=TRUE, of="auc")
rocobj$ci
# On a smoothed ROC, the CI is re-computed automatically
smooth(rocobj)
# Or you can compute a new one:
ci.auc(smooth(rocobj, method="density", reuse.ci=FALSE), boot.n=100)
Run the code above in your browser using DataLab