Skip to contents

Create the Fagan nomogram for Bayesian analysis in diagnostic testing

Usage

nomogrammer(
  Prevalence,
  Sens = NULL,
  Spec = NULL,
  Plr = NULL,
  Nlr = NULL,
  Detail = FALSE,
  NullLine = FALSE,
  LabelSize = (14/5),
  Verbose = FALSE
)

Arguments

Prevalence

Prior probability / prevalence as a number between 0 and 1

Sens

Model sensitivity as a number between 0 and 1 (optional if Plr/Nlr provided)

Spec

Model specificity as a number between 0 and 1 (optional if Plr/Nlr provided)

Plr

Positive likelihood ratio (calculated from Sens and Spec if not provided)

Nlr

Negative likelihood ratio (calculated from Sens and Spec if not provided)

Detail

If TRUE, will overlay key statistics onto the plot

NullLine

If TRUE, will add a line from prior prob through LR = 1

LabelSize

Tweak this number to change the label sizes

Verbose

Print out relevant metrics in the console

Value

A ggplot object with the Fagan nomogram

Examples

# Using sensitivity and specificity
nomogrammer(Prevalence = 0.3, Sens = 0.9, Spec = 0.8)


# Using likelihood ratios
nomogrammer(Prevalence = 0.3, Plr = 4.5, Nlr = 0.125)