Roboculator
Online CalculatorsCategoriesDate & EventsNews
Get Started
Online CalculatorsCategoriesDate & EventsNewsGet Started
Roboculator

Smart calculators for every challenge. Free, fast, and private.

Categories

  • Finance
  • Health
  • Math
  • Construction
  • Conversion
  • Everyday Life

Popular Tools

  • Date & Events
  • Loan Calculator
  • BMI Calculator
  • Percentage Calc
  • Latest News
  • Search All

Resources

  • Glossary
  • Topic Tags
  • News & Insights

Company

  • About
  • Contact

Legal

  • Privacy Policy
  • Terms of Service
  • Editorial Policy
  • Disclaimer
© 2026 Roboculator. All rights reserved.
Roboculator

roboculator.com

  1. Home
  2. /Statistics
  3. /Probability Calculators
  4. /Bayes' Theorem Calculator

Bayes' Theorem Calculator

Last updated: April 5, 2026

The Bayes' Theorem Calculator computes posterior probability from prior, likelihood, and false positive rate. The foundational tool for medical screening interpretation, spam filtering, and any probabilistic reasoning where base rate neglect leads to consistently wrong intuitive conclusions.

Calculator

Results

P(A|B) — Posterior Probability

0.153846

P(B) — Total Probability of Evidence

0.0585

Posterior Probability

15.3846

%

P(A and B) — Joint Probability

0.009

P(¬A and B) — False Positive Joint Probability

0.0495

Posterior Lift vs Prior

15.3846

x

Results

P(A|B) — Posterior Probability

0.153846

P(B) — Total Probability of Evidence

0.0585

Posterior Probability

15.3846

%

P(A and B) — Joint Probability

0.009

P(¬A and B) — False Positive Joint Probability

0.0495

Posterior Lift vs Prior

15.3846

x

In This Guide

  1. 01Bayes' Theorem: The Formula
  2. 02Medical Screening: Why Positive Tests Mislead
  3. 03Applications Beyond Medicine: Spam, Fraud, and Machine Learning
  4. 04Base Rate Neglect: The Most Common Bayesian Error

A positive mammogram result sounds alarming — but what is the actual probability that the patient has cancer? Without applying Bayes' Theorem to account for the test's false positive rate and the disease's base rate, the intuitive interpretation leads to dramatic overestimation of post-test disease probability. The calculator for Bayes' Theorem takes the three key probabilities and computes the correct posterior probability — the result that determines whether a positive screening result warrants urgent intervention or routine follow-up.

Bayes' Theorem: The Formula

The posterior probability P(A|B) — the probability of event A given that B has occurred — is:

P(A|B) = P(B|A) × P(A) / P(B)

where P(B) = P(B|A) × P(A) + P(B|not A) × P(not A) is the total probability of observing B. The three inputs:

  • P(A) = prior probability: the baseline probability of the hypothesis before observing the evidence (disease prevalence, email spam rate, etc.)
  • P(B|A) = likelihood (sensitivity): the probability of observing the evidence if the hypothesis is true (true positive rate)
  • P(B|not A) = false positive rate (1 − specificity): the probability of observing the evidence if the hypothesis is false

Use this online calculator for any prior, likelihood, and false positive rate combination. The Bayesian updating calculator applies sequential updating when multiple pieces of evidence are observed.

Medical Screening: Why Positive Tests Mislead

The classic illustration of Bayes' Theorem is population-level disease screening. Breast cancer mammography screening example:

  • Prevalence P(cancer) = 0.01 (1% in the screened population)
  • Sensitivity P(positive|cancer) = 0.85
  • False positive rate P(positive|no cancer) = 0.10

P(cancer|positive) = (0.85 × 0.01) / (0.85 × 0.01 + 0.10 × 0.99) = 0.0085 / (0.0085 + 0.099) = 0.0085 / 0.1075 = 7.9%. A positive mammogram in routine screening corresponds to less than 8% probability of actual cancer — which is why follow-up imaging (not immediate biopsy) is the standard response. This non-intuitive result arises because the 1% prevalence means there are 99 cancer-free women for every 1 with cancer, and 10% of those 99 generate false positives that overwhelm the true positives from the 1 actual case.

Applications Beyond Medicine: Spam, Fraud, and Machine Learning

Bayesian reasoning appears across virtually every probabilistic inference problem:

  • Email spam filtering: P(spam | word appears) calculated for thousands of words; the product of individual word probabilities (Naive Bayes classifier) determines spam classification
  • Credit fraud detection: P(fraud | transaction pattern) updated continuously as each transaction characteristic is observed; Bayesian updating underlies real-time fraud scoring
  • Navigation and tracking: Kalman filters (used in GPS, aircraft tracking) are a continuous application of Bayesian updating to noisy position estimates
  • A/B testing: Bayesian A/B testing updates conversion probability estimates with each new visitor, allowing continuous monitoring without the fixed sample size requirement of frequentist tests

The conditional probability calculator and probability calculators provide related probability calculation tools.

Base Rate Neglect: The Most Common Bayesian Error

Base rate neglect — ignoring the prior probability P(A) when interpreting evidence — is one of the most documented cognitive biases in human judgment. Kahneman and Tversky's research found that people typically estimate posterior probabilities close to the likelihood P(B|A) alone, ignoring the prior. This leads to consistent overestimation of rare event probabilities (a rare disease feels more likely after a positive test than the calculation warrants) and underestimation of common event probabilities when evidence is weak. Explicitly working through Bayes' Theorem prevents this bias by forcing attention to the prior probability before incorporating new evidence.

Visual Analysis

How It Works

Bayes' theorem is expressed as:

$$P(A|B) = \frac{P(B|A) \cdot P(A)}{P(B)}$$

Where the total probability of B is expanded using the law of total probability:

$$P(B) = P(B|A) \cdot P(A) + P(B|\neg A) \cdot P(\neg A)$$

So the full formula becomes:

$$P(A|B) = \frac{P(B|A) \cdot P(A)}{P(B|A) \cdot P(A) + P(B|\neg A) \cdot (1 - P(A))}$$

Where:

  • P(A) is the prior probability — your initial belief about A before seeing evidence B
  • P(B|A) is the likelihood — the probability of observing B if A is true
  • P(B|¬A) is the false positive rate — the probability of observing B if A is false
  • P(A|B) is the posterior probability — your updated belief about A after observing B

The denominator P(B) serves as a normalizing constant ensuring the posterior is a valid probability. The ratio P(B|A)/P(B) is called the Bayes factor, which quantifies how much the evidence B shifts your belief in A. A Bayes factor greater than 1 increases the probability of A; less than 1 decreases it.

Bayes' theorem is particularly powerful when the prior probability is very different from what intuition might suggest. The classic example is medical screening: even with a highly accurate test, a positive result for a rare disease may still have a low posterior probability because the prior (disease prevalence) is so small.

Understanding Your Results

The posterior P(A|B) tells you the updated probability of hypothesis A after considering evidence B. Compare it to the prior P(A) to understand the impact of the evidence. A large increase from prior to posterior indicates strong evidence. A small increase means the evidence is weak or the false positive rate is high relative to the likelihood.

Key insight: when P(A) is very small (rare events), even tests with high sensitivity and low false positive rates can produce posteriors well below 50%. This is why screening programs for rare diseases often require confirmatory testing.

Worked Examples

Medical Screening: Rare Disease (1% Prevalence)

Inputs

p a0.01
p b given a0.95
p b given not a0.05

Results

p a given b0.160714
p b0.059
posterior pct16.0714

With 1% disease prevalence, 95% test sensitivity, and 5% false positive rate: P(Disease|Positive) = (0.95 × 0.01) / (0.95 × 0.01 + 0.05 × 0.99) = 0.0095/0.059 ≈ 16.1%. Despite a positive test result, there's only a 16% chance of actually having the disease — highlighting why Bayesian reasoning is essential in medicine.

Spam Filter: Email Classification

Inputs

p a0.3
p b given a0.8
p b given not a0.1

Results

p a given b0.774194
p b0.31
posterior pct77.4194

30% of emails are spam. The word 'free' appears in 80% of spam and 10% of legitimate email. P(Spam|'free') = (0.8 × 0.3)/(0.8 × 0.3 + 0.1 × 0.7) = 0.24/0.31 ≈ 77.4%. Seeing the word 'free' raises the spam probability from 30% to 77%.

Frequently Asked Questions

The prior probability P(A) represents your initial belief about the likelihood of hypothesis A before considering the current evidence. It can come from historical data, previous studies, expert opinion, or domain knowledge. In medical testing, the prior is often the disease prevalence in the relevant population. In Bayesian statistics, the choice of prior is explicit and can be updated as more data is collected.

In Bayesian terminology, probability refers to P(A) — the chance of a hypothesis being true. Likelihood refers to P(B|A) — how probable the observed evidence is under a given hypothesis. The likelihood is not a probability of the hypothesis; it is a probability of the data. The likelihood function is central to both Bayesian and frequentist statistics, but its interpretation differs between the two frameworks.

Bayes' theorem reveals that a positive test result does not mean you definitely have the disease. The positive predictive value (posterior probability) depends critically on disease prevalence. For rare diseases (low prior), even excellent tests produce many false positives relative to true positives. A test with 99% sensitivity and 99% specificity applied to a disease with 0.1% prevalence yields a posterior of only about 9%. This is why screening programs require cost-benefit analysis and confirmatory testing protocols.

The Bayes factor is the ratio P(B|A)/P(B|¬A), representing how many times more likely the evidence is under hypothesis A compared to not-A. A Bayes factor of 10 means the evidence is 10 times more probable if A is true. It converts the prior odds P(A)/P(¬A) to posterior odds: posterior odds = Bayes factor × prior odds. Bayes factors above 10 are considered strong evidence, above 100 decisive evidence.

Yes. Bayesian updating is inherently iterative. The posterior from one piece of evidence becomes the prior for the next. After observing evidence B₁, compute P(A|B₁). Then when B₂ is observed, use P(A|B₁) as the new prior to compute P(A|B₁,B₂). This sequential updating is mathematically equivalent to processing all evidence simultaneously and is the foundation of online learning algorithms and adaptive systems.

If P(A) = 0, the posterior P(A|B) is always 0 regardless of evidence — once you are certain A is impossible, no amount of data changes that. Similarly, P(A) = 1 always gives a posterior of 1. These are called dogmatic priors. In practice, Bayesian analysts avoid priors of exactly 0 or 1 because they prevent any learning from data. Instead, use very small or very large values (like 0.001 or 0.999) to represent near-certainty while remaining open to updating.

Sources & Methodology

Bayes, T. (1763). An essay towards solving a problem in the doctrine of chances. Philosophical Transactions, 53, 370-418. McGrayne, S.B. (2011). The Theory That Would Not Die. Yale University Press. Gelman, A. et al. (2013). Bayesian Data Analysis (3rd ed.). CRC Press.

How helpful was this calculator?

5.0/5 (1 rating)

Related Calculators

Cramer's Rule Calculator

Linear Algebra Calculators

Gauss-Jordan Elimination Calculator

Linear Algebra Calculators

Dot Product Calculator

Linear Algebra Calculators

Cross Product Calculator

Linear Algebra Calculators

Square Area Calculator

Plane Geometry Calculators