Diagnostic Test Evaluation
ClinicoPath Development Team
2025-10-09
Source:vignettes/13-diagnostic-tests.Rmd
13-diagnostic-tests.RmdThe meddecide package provides tools to evaluate medical diagnostic tests. This vignette demonstrates the core functions for decision analysis.
Example Data
Small example datasets are included with the package. You can load
them using system.file() and read.csv().
df_dec <- read.csv(system.file("extdata", "decision_example.csv", package = "meddecide"))
head(df_dec)Calculating Diagnostic Metrics
The decision() function computes sensitivity,
specificity and related metrics from raw test results.
res <- decision(data = df_dec,
gold = df_dec$gold,
goldPositive = 1,
newtest = df_dec$newtest,
testPositive = 1,
ci = TRUE)
res$ratioTableWhen you only have the four counts (true positives, false positives,
true negatives and false negatives) you can use
decisioncalculator() directly.
calc <- decisioncalculator(TP = 90, FN = 10, TN = 80, FP = 20,
ci = TRUE, fagan = TRUE)
calc$ratioTableThe option fagan = TRUE adds a Fagan nomogram to
illustrate how the pre-test probability is updated by the diagnostic
result.
calc$faganThese tools help summarise diagnostic performance and can be combined with other functions in meddecide for more advanced analysis.