← Open Biostatistics index
Instant calculation in the browser · verifiable with R Active

Inputs

Prevalence in the setting of use or clinical estimate, from 0 to 1 or as a percentage (30 = 30%).

Likelihood ratio of a positive result (above 1 if the test is useful). Take it from the 2×2 table calculator or from the literature.

Likelihood ratio of a negative result (between 0 and 1 if the test is useful).

Example loaded

Illustrative example: febrile patient in dengue season with a 30% pre-test probability; rapid NS1 antigen test with LR+ = 17 and LR− = 0.158 (from the 2×2 table calculator; fictitious data).

Illustrative data, not real.

Results

Post-test probability after a positive result

87.9%

LR+: 17.00

Post-test probability after a negative result

6.3%

LR−: 0.16

Change with a positive result

+57.9

percentage points

Change with a negative result

−23.7

percentage points

Pre-test odds

0.43

Post-test odds (positive)

7.29

Post-test odds (negative)

0.0677

Interpretation

Starting from a pre-test probability of 30.0% (odds 0.43), a positive result raises it to 87.9% (+57.9 percentage points; odds 7.29) and a negative result lowers it to 6.3% (−23.7 points; odds 0.0677).

LR+ = 17.00: a positive result produces a large and often conclusive change in probability (Jaeschke 1994).

LR− = 0.16: a negative result lowers the probability moderately (Jaeschke 1994).

Deciding whether the post-test probability crosses the treatment threshold or the threshold for further testing is up to the clinician: it depends on the severity of the disease, the risk and benefit of treatment and the diagnostic alternatives (Straus 2019). Jaeschke's cut-offs are guidance, not decision thresholds.

Fagan's nomogram: from the pre-test probability (left) to the post-test probability (right) through the likelihood ratio of each resultPre-test probability: 30.0%. Positive result (LR+ 17.00): 87.9%. Negative result (LR− 0.16): 6.3%.0.1%0.1%0.2%0.2%0.5%0.5%1%1%2%2%5%5%10%10%20%20%30%30%50%50%70%70%80%80%90%90%95%95%98%98%99%99%99.5%99.5%99.8%99.8%99.9%99.9%Pre-test (%)LRPost-test (%)0.0010.010.10.20.5125101001,000Positive result: LR 17.00 · 87.9%Negative result: LR 0.16 · 6.3%
Fagan's nomogram: from the pre-test probability (left) to the post-test probability (right) through the likelihood ratio of each result

Explanation

Before ordering a test the clinician already has an estimate of the probability of disease (pre-test probability: the prevalence in that setting or the clinical impression). The test does not create certainty: it moves that probability up if positive and down if negative. How far it moves it is what the likelihood ratios tell.

The calculation is Bayes' theorem (1763) written with odds: the post-test odds are the pre-test odds multiplied by the likelihood ratio of the result obtained. Odds are the probability divided by its complement (30% equals 0.43, that is, 3 to 7) and are converted back to a probability at the end.

Fagan's nomogram (1975) does the calculation with a ruler: join the pre-test probability (left axis) with the likelihood ratio (centre axis) and the straight line crosses the right axis at the post-test probability. Here one line is drawn per result, positive and negative.

Jaeschke, Guyatt and Sackett (1994) proposed guiding cut-offs to read an LR: above 10 (or below 0.1) produces large, often conclusive changes; 5 to 10 (0.1 to 0.2), moderate; 2 to 5 (0.2 to 0.5), small but sometimes important; between 1 and 2 (0.5 to 1), rarely important. They are conventions, not decision thresholds: the treatment threshold is set by the clinical situation.

Equations

Opre=P1−P,Opost=Opre×LR,Ppost=Opost1+OpostO_{\mathrm{pre}}=\frac{P}{1-P},\qquad O_{\mathrm{post}}=O_{\mathrm{pre}}\times \mathrm{LR},\qquad P_{\mathrm{post}}=\frac{O_{\mathrm{post}}}{1+O_{\mathrm{post}}}
PP
pre-test probability
Opre, OpostO_{\mathrm{pre}},\ O_{\mathrm{post}}
pre-test and post-test odds
LR\mathrm{LR}
likelihood ratio of the result obtained (LR+ if positive, LR− if negative)
Bayes' theorem in odds form: exactly what Fagan's nomogram (1975) solves.
P(D∣T+)=P(T+∣D) P(D)P(T+∣D) P(D)+P(T+∣Dˉ) P(Dˉ)P(D\mid T^{+})=\frac{P(T^{+}\mid D)\,P(D)}{P(T^{+}\mid D)\,P(D)+P(T^{+}\mid \bar D)\,P(\bar D)}
D, DˉD,\ \bar D
disease present and absent
T+T^{+}
positive test result
Classic form of Bayes' theorem (1763); P(T⁺ | D) is the sensitivity and P(T⁺ | D̄) is 1 − specificity.
LR+=Sn1−Sp,LR−=1−SnSp\LRp=\frac{\Sn}{1-\Sp},\qquad \LRn=\frac{1-\Sn}{\Sp}
Likelihood ratios come from sensitivity and specificity ("Diagnostic test (2×2 table)" calculator).

R code

# Post-test probability by Bayes' theorem in odds form (Fagan 1975) - Bioestadistica abierta, UDG-CA-1190
# Runs as is in R, RStudio or webR; prints the results as JSON at the end.
library(jsonlite)

pre <- 0.3; lr_pos <- 17; lr_neg <- 0.158   # pre-test probability (0-1) and likelihood ratios

momios <- function(p) p / (1 - p)     # probability -> odds
post <- function(p, lr) {             # post-test probability; certainties (0 and 1) stay fixed
  if (p <= 0) return(0)
  if (p >= 1) return(1)
  o <- p / (1 - p) * lr
  o / (1 + o)
}
momios_pre <- momios(pre)
momios_post_pos <- momios_pre * lr_pos
momios_post_neg <- momios_pre * lr_neg
post_pos <- post(pre, lr_pos)         # after a positive result
post_neg <- post(pre, lr_neg)         # after a negative result

res <- list(post_pos = post_pos, post_neg = post_neg,
            ganancia_pos = post_pos - pre, ganancia_neg = pre - post_neg,
            momios_pre = momios_pre, momios_post_pos = momios_post_pos, momios_post_neg = momios_post_neg)
cat(toJSON(res, auto_unbox = TRUE, digits = NA))

This is the very code that validates the calculator: copy it and run it in R or RStudio to reproduce the result.

In-browser verification with R will arrive in a forthcoming version; meanwhile, copy the code and run it in RStudio.

Methods for a manuscript

The post-test probability was computed with Bayes' theorem in odds form (post-test odds = pre-test odds × likelihood ratio) [1] and displayed with Fagan's nomogram [2]; the magnitude of the change was interpreted with the guiding cut-offs of Jaeschke et al. [3]. Calculations used the "Post-test probability (Fagan)" calculator of Bioestadística abierta (Research Group UDG-CA-1190, https://udgca1190.com.mx/en/herramientas/bioestadistica/probabilidad-posprueba), verified against R.

A paragraph ready for the Methods section; bracketed numbers refer to the reference list.

References

  1. 01 Bayes T. An essay towards solving a problem in the doctrine of chances. Philosophical Transactions of the Royal Society of London. 1763;53:370–418. doi:10.1098/rstl.1763.0053 Original source
  2. 02 Fagan TJ. Nomogram for Bayes's theorem. New England Journal of Medicine. 1975;293(5):257. doi:10.1056/NEJM197507312930513 PMID: 1143310 Original source
  3. 03 Jaeschke R, Guyatt GH, Sackett DL. Users' guides to the medical literature. III. How to use an article about a diagnostic test. B. What are the results and will they help me in caring for my patients? JAMA. 1994;271(9):703–707. doi:10.1001/jama.271.9.703 PMID: 8309035 Original source
  4. 04 McGee S. Simplifying likelihood ratios. Journal of General Internal Medicine. 2002;17(8):646–649. doi:10.1046/j.1525-1497.2002.10750.x PMID: 12213147 Complementary
  5. 05 Deeks JJ, Altman DG. Diagnostic tests 4: likelihood ratios. BMJ. 2004;329(7458):168–169. doi:10.1136/bmj.329.7458.168 PMID: 15258077 Didactic reading
  6. 06 Straus SE, Glasziou P, Richardson WS, Haynes RB. Evidence-Based Medicine: How to Practice and Teach EBM. 5th ed. Edinburgh: Elsevier; 2019. Didactic reading