knitr::opts_chunk$set(collapse = TRUE, comment = "#>")
The meddecide package provides tools to evaluate medical diagnostic tests. This vignette demonstrates the core functions for decision analysis.
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)
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$ratioTable
When 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$ratioTable
The option fagan = TRUE
adds a Fagan nomogram to illustrate how the
pre-test probability is updated by the diagnostic result.
calc$fagan
These tools help summarise diagnostic performance and can be combined with other functions in meddecide for more advanced analysis.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.