b2KIT

Bayesian Probability Calculator

Calculate posterior probabilities with Bayes theorem. Visualize prior, likelihood, and posterior with tree diagrams and area plots.

Tested tool guide Tested browser tools Checked August 15, 2026

What Bayesian Probability Calculator does, with a checked example

Enter a prior probability, a true-positive rate (sensitivity), and a false-positive rate, and the calculator plugs them into Bayes' theorem to return the posterior probability of the event given a positive observation. It shows the same numbers two ways: a branching probability tree with prior x likelihood along each path, and a stacked area plot where dragging the prior slider shows how the posterior share shifts in real time. The most common surprise is how low the posterior stays when the prior is small, even with a highly accurate test - the base rate dominates.

Worked example

A concrete input and expected output from the current implementation.

Input

Prior P(event) = 1%, sensitivity P(positive | event) = 90%, false-positive rate P(positive | no event) = 5%

Expected output

P(event | positive) = 15.38%

P(positive) = 0.9x0.01 + 0.05x0.99 = 0.0585, so the posterior is 0.009 / 0.0585 = 0.1538, meaning most positives come from the much larger pool of non-events even though the test is 90% sensitive.

How the result is produced

1

Direct Bayes computation

The tool takes the prior P(A), the likelihood P(B|A), and the false-positive rate P(B|not A), then computes P(A|B) = P(B|A)P(A) / [P(B|A)P(A) + P(B|not A)P(not A)]. It displays the joint probabilities for each of the four prior/likelihood combinations alongside the final ratio, so the numerator and full denominator are both visible, not just the result.

2

Tree and area views

The tree diagram branches first on the prior (event / no event), then on the observation (positive / negative) under each branch, labeling every path with its joint probability. The area plot stacks the same four joint probabilities as proportional bands across a 0-1 axis, and both redraw immediately as any of the three input fields changes.

Good uses

  • checking how much a positive screening test result should actually shift your belief given a low-prevalence condition
  • sanity-checking a spam or fraud filter's flagged rate against its known false-positive rate
  • building a visual walkthrough of Bayes' theorem for a stats class using the tree and area plot together

Limits and checks

  • the posterior is only as good as the three inputs - if the prior or false-positive rate is a guess rather than a measured rate, the output inherits that uncertainty without any warning
  • the calculator supports one binary hypothesis (event vs. not event) with one binary observation; it does not extend to multi-class or continuous-evidence Bayesian updates
  • the prior must match the population the case actually belongs to - plugging in a general population base rate for someone who already has risk factors will understate the true posterior

Common questions

Why is my posterior so much lower than the test's stated accuracy?

This is the base-rate effect: when the prior is small, the absolute number of false positives from the large 'no event' group can exceed the true positives from the small 'event' group, even at high sensitivity. The tool's tree view makes this visible by showing both false-positive and true-positive path probabilities side by side.

Can I chain this to update the posterior again with a second piece of evidence?

Only if the two pieces of evidence are conditionally independent given the event and given its complement - the standard 'naive Bayes' assumption. In that case, re-entering the posterior as the new prior and running a second pass with the next likelihood gives the correct combined posterior. If the two observations are dependent (the second is more or less likely given that the first already occurred), that second likelihood must instead be conditioned on the first observation, which this single-pass calculator does not model - chaining runs naively will produce the wrong answer.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools