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,
  samplesize = FALSE,
  expected_sens = 0.85,
  expected_spec = 0.8,
  width_sens = 0.1,
  width_spec = 0.1,
  alpha_level = 0.05
)

Arguments

sens

.

spec

.

prev

.

repeat2

.

repeat3

.

fnote

.

fagan

.

samplesize

.

expected_sens

.

expected_spec

.

width_sens

.

width_spec

.

alpha_level

.

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
results$sampleSizeTablea table

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