STATISTICS • PROBABILITY
Bayes’ Theorem Visualizer
Adjust a prior and evidence likelihoods to see how true-positive and false-positive probability mass combine into a posterior.
Updating probability with evidence
The area map makes the denominator visible: a positive result can contain both true-positive mass and false-positive mass from the much larger alternative population.
LEARN WITH THE SIMULATION
Understand Bayes’ Theorem Visualizer by experimenting.
Bayes’ theorem reverses conditional probability after evidence arrives. This visualizer makes the denominator visible by separating positive evidence into true-positive mass from the hypothesis group and false-positive mass from the alternative group. By changing the prior, sensitivity and false-positive rate, learners can see why identical test characteristics can imply very different posterior probabilities in populations with different base rates.
BUILD THE IDEA
What you should understand first
- Compute posterior probability from a prior and competing evidence likelihoods.
- Explain the base-rate effect using true-positive and false-positive mass rather than formula memorization.
- Translate probabilities into natural-frequency counts so the denominator of Bayes’ theorem is visible.
- Relate prior odds, likelihood ratios and posterior probability as different views of the same update.
TRY IT YOURSELF
Why can a highly sensitive test still produce a modest positive predictive value?
- Set a low prior probability while keeping sensitivity high and the false-positive rate modest.
- Turn on the 1,000-case comparison and compare expected true positives with expected false positives.
- Raise only the prior and watch the posterior change even though the test itself is unchanged.
- Reduce the false-positive rate and compare which adjustment matters most in a rare-condition scenario.
When the prior is small, the alternative population is much larger. Even a modest false-positive rate can therefore create as much or more positive evidence than the true-positive group, so the posterior must normalize both sources.
WHY IT WORKS 01
The denominator is the whole story
The numerator P(B|A)P(A) measures evidence generated by the hypothesis group, but the denominator P(B) also includes evidence generated when the hypothesis is false. The area model exposes those contributions side by side. A posterior becomes large only when hypothesis-generated evidence dominates all evidence of the same observed type.
WHY IT WORKS 02
Natural frequencies reduce conditioning confusion
Expressing the same scenario as expected counts out of 1,000 cases turns an abstract conditional-probability formula into bookkeeping. Count expected true positives and expected false positives, add them to obtain all positives, and then ask what fraction came from the hypothesis group. The arithmetic is the same Bayes update in a more concrete representation.
DO NOT MIX THESE UP
Common misconception
Sensitivity P(B|A) is not the same as the posterior P(A|B). Reversing the conditioning direction requires the prior and the competing evidence likelihood. A high sensitivity alone does not guarantee a high positive predictive value, especially when the underlying condition is rare.
PRACTICE CHALLENGE
Can you reach the same posterior with two very different priors and test qualities?
- Set a target posterior and find one solution using a low prior and a very low false-positive rate.
- Find another solution with a higher prior but weaker evidence.
- Compare the natural-frequency counts and explain why both scenarios produce approximately the same posterior.
Reveal the reasoning
Bayes’ theorem depends on weighted evidence from both hypotheses. A lower prior can be offset by stronger likelihood evidence, while a higher prior requires less dramatic evidence to reach the same posterior. Different parameter combinations can therefore map to the same posterior probability.
MODEL BOUNDARIES
What this simulation assumes
Every simulation simplifies reality or a mathematical system. These are the assumptions and limits to keep in mind while interpreting the results.
Model assumptions
- The evidence has one sensitivity P(B|A) and one false-positive rate P(B|¬A).
- The prior population is partitioned into mutually exclusive A and ¬A groups.
- Posterior probabilities follow exact conditional-probability arithmetic.
Model limitations
- Dependencies between repeated tests, uncertain priors and parameter-estimation error are omitted.
- The visualizer models a binary hypothesis and binary evidence outcome only.
CONNECT IT
Where this matters
- Medical screening and diagnostic testing
- Spam, fraud and anomaly detection
- Scientific inference and evidence updating
- Risk assessment and probabilistic decision support
WORDS THAT MATTER
Key vocabulary
- Prior
- Probability assigned to a hypothesis before the current evidence is observed.
- Likelihood
- Probability of observing the evidence under a specified hypothesis or alternative.
- Posterior
- Updated probability of the hypothesis after the evidence is incorporated.
- Likelihood ratio
- Ratio comparing how probable the evidence is under the hypothesis versus the alternative.
- Base-rate effect
- The influence of the starting prevalence or prior probability on the interpretation of evidence.
NEXT STEP