Elysia Tools

Navigation

Math

Bayes’ Theorem Visualization

Compare prior and posterior probabilities with a hypothetical screening test and an interactive probability area diagram.

Open static visualization

Tool usage guide

Learn when to use this tool, what it supports, and how real users apply it.

Overview

Load the textbook example and then switch to Higher prevalence. The sensitivity and the false-positive rate stay fixed, while the positive predictive value moves from 16.10% to 67.86%. The expected counts show where the difference comes from.

From two conditional rates to the posterior

Let H be the hypothesis and E the evidence. The product P(H)P(E|H) gives the joint probability. Add the other branch, P(¬H)P(E|¬H), to obtain P(E). Dividing the joint probability by P(E) gives the posterior when P(E) > 0.

Count the expected positive results

In the hypothetical population of 10,000, multiply the true-positive and false-positive joint probabilities by 10,000. Their expected counts add to the expected total positives. Keeping the fractions until the final division matters most when the condition is rare.

How it works

  1. 1Open Hypothetical screening and load a preset. Read the three probabilities and the expected counts beside them.
  2. 2Divide true positives by all positives. Change the prevalence and compare the two colored portions of the positive strip.
  3. 3Switch to General Bayes update and change the evidence rates on the two branches. Their shaded areas add to P(E).

Edge cases & common failures

  • Zero marginal probability

    When both branches make E impossible, P(E) = 0. The denominator is zero and the posterior displays a dash.

  • Fractional expected counts

    Each number is an expectation calculated from a probability. A grid cell can share two colors. The numerical readouts show the contribution of small areas.

Examples

1. Textbook example

How to use

Load Textbook example and compare 95 true positives with 495 false positives.

Outcome

The positive predictive value is 95 / 590, about 16.10%.

2. Higher prevalence

How to use

Load Higher prevalence and compare both test rates with the previous example.

Outcome

At 10% prevalence, the positive predictive value is about 67.86%.

3. Equally likely evidence

How to use

In General Bayes update, load Equally likely evidence.

Outcome

Both evidence rates are 40%. The posterior stays at its 30% prior.

FAQ

Why do sensitivity and the posterior differ?

Sensitivity is the proportion of positives among people with the condition. The posterior is the proportion with the condition among those who tested positive. Each uses a different denominator.

At a Glance

Interactive Preview

Bayes’ Theorem Visualization
Static preview of this visualization. Use the interactive panel above to explore it.

Verified Results

Typical Experiments and Results

Every parameter set and result below is a fixed output of this page's built-in model (each asserted before delivery) and reproduces directly: set the Parameters column in the interactive panel.

ScenarioParametersResult
Rare conditionP(H) = 0.10%, P(E|H) = 99%, P(E|¬H) = 1%TP = 9.9, FP = 99.9, P(H|E) ≈ 9.02%
Textbook exampleP(H) = 1%, P(E|H) = 95%, P(E|¬H) = 5%TP = 95, FP = 495, P(H|E) ≈ 16.10%
Higher prevalenceP(H) = 10%, P(E|H) = 95%, P(E|¬H) = 5%TP = 950, FP = 450, P(H|E) ≈ 67.86%
Evidence favors HP(H) = 50%, P(E|H) = 80%, P(E|¬H) = 20%P(E) = 50%, P(H|E) = 80%
Equally likely evidenceP(H) = 30%, P(E|H) = 40%, P(E|¬H) = 40%P(E) = 40%, P(H|E) = 30%
Impossible evidenceP(H) = 50%, P(E|H) = 0%, P(E|¬H) = 0%P(E) = 0%, P(H|E) = —

Sources

References

Papers and datasets underlying this visualization - every formula, algorithm, and data anchor on the page traces back to the sources below.

  1. [1]

    Thomas Bayes (1763). LII. An essay towards solving a problem in the doctrine of chances. By the late Rev. Mr. Bayes, F. R. S. communicated by Mr. Price, in a letter to John Canton, A. M. F. R. S. Philosophical Transactions of the Royal Society of London 53, 370–418.

    View source→ Original inverse-probability problem
  2. [2]

    John Tsitsiklis (2018). Lecture 2: Conditioning and Bayes' Rule. MIT OpenCourseWare, RES.6-012 Introduction to Probability.

    View source→ P(E) = P(H)P(E|H) + P(¬H)P(E|¬H)
  3. [3]

    Penn State Department of Statistics. Bayes’ Theorem. STAT 414 | Introduction to Probability Theory, Lesson 6.

    View source→ Example 6.2, P(H) = 0.01, P(E|H) = 0.95, P(E|¬H) = 0.05
  4. [4]

    Gerd Gigerenzer, Ulrich Hoffrage (1995). How to Improve Bayesian Reasoning Without Instruction: Frequency Formats. Psychological Review 102(4), 684–704.

    View source→ Frequency format, P(H|E) = TP/(TP + FP)
  5. [5]

    Chris Piech (2016). Medical Tests. Stanford CS109, Probability for Computer Scientists.

    View source→ Population diagram with four joint outcomes

Related

Related tools and workflows

Format Conversion

AsciiMath LaTeX MathML Equation Converter

Convert equations between AsciiMath, LaTeX and MathML: auto-detect the input format, produce canonical LaTeX, presentation MathML with an embedded TeX annotation, a best-effort AsciiMath back-translation, a screen-reader aria-label snippet (role=math), and a KaTeX HTML preview.

Math & Numbers

Bayes Theorem Calculator

Calculate posterior probability P(A given B) using prior, likelihood, and false-positive rate

AI Tools

AI Math Solver/Photomath

Solve math problems from images using AI vision models with step-by-step explanations

Data Visualization

Central Limit Theorem Demonstrator

See the Central Limit Theorem in action: draw samples from a non-normal source distribution (uniform, exponential, Poisson, or Bernoulli), plot the histogram of sample means, and overlay the predicted Normal curve N(μ, σ²/n). Compare empirical vs theoretical mean and standard error, and watch convergence tighten as the sample size grows.

Next

More visualizations nearby

Cookie settings

Essential cookies keep the site running. Analytics and personalized ads are optional.

Cookie policy