Bayes' Theorem 3D Simulator — Base Rates & Screening Interactive

Interactive 3D Bayes' theorem simulator with an incoming production stream, defect and nondefect branches, positive and negative screening and a positive-result composition view, plus live charts, equations, guided experiments and a quiz.

← Statistics & Data Science Labs
About this tool — how it works & FAQOpen ▾Close ▴

About the Bayes' Theorem 3D Simulator

This simulator is a factory-screening probability tree. Set how common defects are, how well the screen catches them (sensitivity) and how well it clears good parts (specificity), then follow expected counts through the branches to the probability that a part is defective given that it screened positive.

What the simulator shows

• A real-time 3D scene with 4 inspectable parts (Incoming production, Defect / nondefect branches, Positive / negative screening and Positive-result composition), with home view, focus-selected-part, auto-rotate, expand, instrument-cover and hide-labels scene tools, plus a model response curve beneath the scene. • Experiment controls: Defect prevalence (0.001-0.2); Sensitivity (0.5-0.99); Specificity (0.8-0.999); Repeatable random seed (1-99); show animated explanatory markers; pause/resume, 0.1 s and 1 s single-step buttons, four playback speeds and a restart button. • A Curves & measurements tab with a parameter-comparison chart, a live-measurements chart, the model equations and snapshot readouts (P(defect | positive); P(positive); Expected true positives /10000; Expected false positives /10000; P(defect | negative)). • An Experiments tab with 2 guided presets (rare defects and higher specificity) and a Model verification bench that runs independent fresh models, plus a timestamped event log and a copyable trial report. • A Learn & assess tab with guided lessons, a knowledge-check quiz with reset and a written model-scope statement linking to a technical reference.

Following the tree to the posterior

Out of every 10,000 parts, prevalence times 10,000 are defective and sensitivity of those test positive (true positives), while the non-defective parts produce false positives at a rate of one minus specificity. The probability of a defect given a positive result is true positives divided by all positives, which the lab reports alongside the overall probability of a positive and the probability of a defect given a negative.

Because sensitivity is P(positive given defect), it is not the same as P(defect given positive); reversing the conditional requires the base rate.

Why rare defects surprise people

At low prevalence a small false-positive rate acting on a huge number of good parts can produce more false positives than true positives, so most positive results are not defects even for an accurate screen. The rare-defects and higher-specificity experiments make this concrete.

Counts are expectations and may be fractional, and the visual tokens are illustrative rather than one token per item. The model covers a single screening result with known conditional probabilities; it does not model repeated tests or any medical application.

Frequently asked questions

Is sensitivity the same as the probability of a defect given a positive result?

No. Sensitivity is P(positive given defect). The probability of a defect given a positive result, P(defect given positive), depends on the base rate and the false-positive rate as well, as Bayes' theorem shows.

Why can most positive results be false positives?

When the condition is rare, even a small false-positive rate applied to the large good population yields many false positives, which can outnumber the true positives from the small defective population.

What happens when specificity improves?

False positives fall in proportion to one minus specificity, so the composition of positive results shifts toward true positives and the posterior probability of a defect rises, as the higher-specificity experiment shows.

Does this simulator give medical advice?

No. It is a general probability illustration using a factory-screening story with known conditional probabilities, and it implies no medical application or repeated-test independence.

Related tools & guides