Decision Curve Analysis for evaluating the clinical utility of prediction models and diagnostic tests. Calculates net benefit across threshold probabilities to determine if using a model provides more benefit than default strategies.
Usage
decisioncurve(
data,
outcome,
outcomePositive,
models,
modelNames = "",
thresholdRange = "clinical",
thresholdMin = 0.05,
thresholdMax = 0.5,
thresholdStep = 0.01,
showTable = TRUE,
selectedThresholds = "0.05, 0.10, 0.15, 0.20, 0.25, 0.30",
showPlot = TRUE,
plotStyle = "standard",
showReferenceLinesLabels = TRUE,
highlightRange = FALSE,
highlightMin = 0.1,
highlightMax = 0.3,
calculateClinicalImpact = FALSE,
populationSize = 1000,
showInterventionAvoided = FALSE,
confidenceIntervals = FALSE,
bootReps = 1000,
ciLevel = 0.95,
showOptimalThreshold = TRUE,
compareModels = FALSE,
weightedAUC = FALSE
)
Arguments
- data
The data as a data frame.
- outcome
Binary outcome variable (0/1 or FALSE/TRUE). This represents the condition or event you want to predict.
- outcomePositive
Which level of the outcome variable represents the positive case (presence of condition/event).
- models
Variables representing predicted probabilities or risk scores from different models. Can include multiple models for comparison.
- modelNames
Optional comma-separated list of names for the models. If not provided, variable names will be used.
- thresholdRange
Range of threshold probabilities to evaluate.
- thresholdMin
Minimum threshold probability when using custom range.
- thresholdMax
Maximum threshold probability when using custom range.
- thresholdStep
Step size between threshold probabilities.
- showTable
Display table with net benefit values at selected thresholds.
- selectedThresholds
Comma-separated list of threshold probabilities to display in table.
- showPlot
Display the decision curve plot.
- plotStyle
Style of the decision curve plot.
- showReferenceLinesLabels
Show labels for "Treat All" and "Treat None" reference lines.
- highlightRange
Highlight a clinically relevant threshold range on the plot.
- highlightMin
Minimum threshold for highlighted range.
- highlightMax
Maximum threshold for highlighted range.
- calculateClinicalImpact
Calculate clinical impact metrics (number needed to screen, etc.).
- populationSize
Population size for calculating clinical impact metrics.
Show how many unnecessary interventions are avoided compared to treat-all.
- confidenceIntervals
Calculate bootstrap confidence intervals for net benefit curves.
- bootReps
Number of bootstrap replications for confidence intervals.
- ciLevel
Confidence level for bootstrap confidence intervals.
- showOptimalThreshold
Identify and display optimal threshold probabilities for each model.
- compareModels
Calculate statistical tests for comparing model performance.
- weightedAUC
Calculate weighted area under the decision curve.
Value
A results object containing:
results$instructions | a html | ||||
results$procedureNotes | a html | ||||
results$resultsTable | a table | ||||
results$optimalTable | a table | ||||
results$clinicalImpactTable | a table | ||||
results$comparisonTable | a table | ||||
results$weightedAUCTable | a table | ||||
results$dcaPlot | an image | ||||
results$clinicalImpactPlot | an image | ||||
results$interventionsAvoidedPlot | an image | ||||
results$summaryText | a html |
Tables can be converted to data frames with asDF
or as.data.frame
. For example:
results$resultsTable$asDF
as.data.frame(results$resultsTable)