User Rating 0.0 โ˜…โ˜…โ˜…โ˜…โ˜…
Total Usage 0 times

Probability of hypothesis before evidence

True positive rate (sensitivity)

1 โˆ’ Specificity

Presets:
Is this tool helpful?

Your feedback helps us improve.

โ˜… โ˜… โ˜… โ˜… โ˜…

About

Misapplying conditional probability costs lives and money. A medical test with 99% accuracy applied to a disease with 0.1% prevalence yields a positive predictive value below 10%. Most professionals get this wrong. Bayes' theorem corrects the intuition failure by computing the posterior probability P(A|B) from three inputs: the prior P(A), the true positive rate P(B|A), and the false positive rate P(B|ยฌA). This calculator implements both the standard and odds forms, handles edge cases where P(B) = 0, and displays the full decomposition via the Law of Total Probability.

The tool assumes binary hypothesis space (A vs ยฌA). For multi-class problems, apply sequential updating. Note that the model treats all probabilities as exact point estimates. It does not account for uncertainty in the parameters themselves. For robust inference under parameter uncertainty, use a full Bayesian framework with conjugate priors.

bayes theorem posterior probability conditional probability bayesian inference statistics calculator prior probability likelihood ratio

Formulas

The standard form of Bayes' theorem for a binary hypothesis:

P(A|B) = P(B|A) โ‹… P(A)P(B)

The denominator P(B) is expanded using the Law of Total Probability:

P(B) = P(B|A) โ‹… P(A) + P(B|ยฌA) โ‹… P(ยฌA)

The odds form provides an alternative representation using the likelihood ratio LR:

LR = P(B|A)P(B|ยฌA)
Posterior Odds = LR ร— Prior Odds = LR ร— P(A)1 โˆ’ P(A)

Where: P(A) = prior probability of hypothesis A being true. P(B|A) = likelihood (sensitivity, true positive rate). P(B|ยฌA) = false positive rate (1 โˆ’ specificity). P(A|B) = posterior probability after observing evidence B. LR = likelihood ratio, quantifying the diagnostic strength of the evidence.

Reference Data

DomainPrior P(A)Sensitivity P(B|A)False Positive P(B|ยฌA)Posterior P(A|B)Notes
Breast Cancer Screening (Mammography)0.0080.900.070.094~9.4% PPV despite high sensitivity
HIV ELISA Test0.0030.9980.00010.968Very low false positive rate drives high PPV
COVID-19 Rapid Antigen (High Prevalence)0.150.720.020.864Prevalence 15% scenario
COVID-19 Rapid Antigen (Low Prevalence)0.010.720.020.267Same test, different context
Email Spam Filter0.400.950.050.927Assumes 40% spam base rate
Airport Security (Contraband)0.00010.950.100.00095Base rate fallacy in security screening
Criminal Court (DNA Match)0.0010.99990.00010.909Prosecutor's fallacy if prior ignored
Drug Test (Workplace)0.050.990.010.8395% user prevalence assumed
Weather Forecast (Rain)0.300.800.100.774Climatological prior for temperate region
Fire Alarm (Real Fire)0.00050.990.020.024Most alarms are false
Manufacturing Defect Detection0.020.950.030.393Quality control at 2% defect rate
Rare Disease Genetic Test0.00010.9990.0050.020Illustrates danger of screening rare conditions
Financial Fraud Detection0.010.850.050.1471% transaction fraud rate
Self-Driving Car Object Detection0.0010.9990.0010.500Equal likelihood ratio at this prior
Pregnancy Test0.300.990.010.977High prior among test-takers

Frequently Asked Questions

The base rate fallacy. When the prior probability P(A) is very small (e.g., 0.001), even a small false positive rate P(B|ยฌA) of 0.01 generates far more false positives than true positives in absolute numbers. With 1,000,000 people tested, 1,000 have the disease (990 detected), but 9,990 healthy people also test positive. The posterior becomes approximately 0.09, or 9%.
Sensitivity equals P(B|A), the true positive rate. Specificity equals 1 โˆ’ P(B|ยฌA). This calculator asks for the false positive rate directly, which is 1 โˆ’ specificity. If your test has 95% specificity, enter 0.05 (or 5%) as the false positive rate.
Yes. Run the calculator once to get the posterior P(A|B1). Then use that posterior as the new prior P(A) for the second piece of evidence B2. This is valid only when evidence pieces are conditionally independent given the hypothesis. Correlated evidence requires joint likelihood modeling.
If P(B) = 0, the evidence B is impossible under both hypotheses. Bayes' theorem is undefined (division by zero). The calculator detects this case and reports it as an error. In practice, this means your likelihood and false positive rate are both exactly zero, which implies the evidence cannot occur.
The likelihood ratio LR = P(B|A) รท P(B|ยฌA) measures how much the evidence shifts the odds. LR > 10 is considered strong evidence. LR > 100 is very strong. LR = 1 means the evidence is uninformative. LR < 1 means the evidence supports ยฌA.
Both. Bayes' theorem is agnostic about the interpretation of probability. Enter a frequentist prior (e.g., disease prevalence from epidemiological data) or a subjective degree of belief (e.g., your confidence that a suspect is guilty before seeing DNA evidence). The mathematics are identical. The philosophical debate is about where P(A) comes from, not how it is computed.
The fraction form gives the posterior probability directly. The odds form is more intuitive for sequential updating and for understanding the diagnostic power of evidence. In the odds form, you multiply the prior odds by the likelihood ratio. This makes it trivial to chain multiple evidence updates: each new piece of evidence contributes another multiplicative factor. Medical professionals and legal analysts often prefer the odds form.