Tools · Open Biostatistics
Post-test probability: Bayes' theorem and Fagan's nomogram
Enter the pre-test probability and the likelihood ratios of the test (LR+ and LR−) and get the post-test probability after a positive and after a negative result, the change in percentage points, Fagan's nomogram, the interpretation and the equivalent R code.
https://udgca1190.com.mx/en/herramientas/bioestadistica/probabilidad-posprueba
This link does not include the pasted data: they are too long for a URL.
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.
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
- pre-test probability
- pre-test and post-test odds
- likelihood ratio of the result obtained (LR+ if positive, LR− if negative)
- disease present and absent
- positive test result
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
- 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
- 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
- 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
- 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
- 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
- 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