Skip to contents

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.

showInterventionAvoided

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$instructionsa html
results$procedureNotesa html
results$resultsTablea table
results$optimalTablea table
results$clinicalImpactTablea table
results$comparisonTablea table
results$weightedAUCTablea table
results$dcaPlotan image
results$clinicalImpactPlotan image
results$interventionsAvoidedPlotan image
results$summaryTexta html

Tables can be converted to data frames with asDF or as.data.frame. For example:

results$resultsTable$asDF

as.data.frame(results$resultsTable)

Examples

# \donttest{
# example will be added
# }