Skip to contents

Calculates positive and negative predictive values for screening and diagnostic tests using Bayes' theorem. Demonstrates how disease probability changes with sequential testing and provides Fagan nomograms for clinical decision-making.

Usage

screeningcalculator(
  sens = 0.9,
  spec = 0.8,
  prev = 0.1,
  repeat2 = TRUE,
  repeat3 = TRUE,
  fnote = FALSE,
  fagan = FALSE
)

Arguments

sens

.

spec

.

prev

.

repeat2

.

repeat3

.

fnote

.

fagan

.

Value

A results object containing:

results$explanatoryTexta html
results$mathTexta html
results$singleTestTablea table
results$repeatTest2Tablea table
results$repeatTest3Tablea table
results$plot1an image
results$plot2PPan image
results$plot2NNan image
results$plot3PPPan image
results$plot3NNNan image

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

results$singleTestTable$asDF

as.data.frame(results$singleTestTable)

Details

This calculator is particularly useful for: • Understanding screening test performance in different prevalence settings • Sequential testing scenarios (confirmatory testing) • Teaching Bayesian probability concepts in medical decision-making • Evaluating diagnostic test chains in clinical workflows

Examples

# COVID-19 rapid test in community screening (low prevalence)
# Sensitivity: 85\%, Specificity: 95\%, Prevalence: 2\%
data(screening_examples)
covid_community <- screening_examples[1, ]

# Mammography screening in women aged 50-69
# Demonstrates low PPV due to low cancer prevalence
mammo_data <- screening_examples[screening_examples$scenario == "Mammography Screening", ]

# Sequential testing example: HIV screening followed by confirmatory test
# Shows how probability increases dramatically with confirmatory testing
hiv_screening <- screening_examples[screening_examples$scenario == "HIV Testing", ]

# Prevalence effect demonstration
# Shows how identical test performs differently at various prevalence levels
data(prevalence_demo)

# Load example datasets for realistic clinical scenarios
data(screening_examples)  # 15 clinical scenarios across specialties
data(prevalence_demo)     # Prevalence effect demonstration
data(performance_demo)    # Test performance comparisons
data(sequential_demo)     # Sequential testing examples
data(common_tests)        # Reference test characteristics