Bayes theorem calculator

Use the event rate, signal sensitivity and false-alarm rate to update the probability after a signal.

Example: event = a defective item; signal = inspection flags it.

Event before the signal
%
Signal if the event occurs
%
Signal without the event
%

Probability of the event after the signal

15.3846%

Signal among all cases5.85%
False signals among signals84.6154%

Contents

How a signal changes an event probability

Two possible event branches and their signal outcomes

A signal can be common even when the event behind it is rare. This calculator combines the event's starting rate with the signal's true and false alarm rates to answer what a signal means.

How the three rates fit together

Call the event A and the observed signal S. Enter the share of cases with A, the share of those cases that show S, and the share without A that still show S. Bayes' theorem compares the genuine signals with every way a signal can occur.

P(AโˆฃS)=P(SโˆฃA)P(A)P(SโˆฃA)P(A)+P(SโˆฃยฌA)P(ยฌA)P(A\mid S)=\frac{P(S\mid A)P(A)}{P(S\mid A)P(A)+P(S\mid\neg A)P(\neg A)}

Three ways to test your intuition

Suppose 1% of products are defective, inspection flags 90% of defects and also flags 5% of good products. Among 10,000 items there are 90 genuine flags and 495 false flags. A flagged item has a 90 / 585 = 15.3846% chance of being defective.

If 20% of items have a marking error, a scanner catches 80% of them and flags 10% of clean items, then 16 of every 100 cases are genuine signals and 8 are false. The probability after a flag is 16 / 24 = 66.6667%.

If 30% of messages belong to a category and both the category and the other messages trigger a filter 40% of the time, the signal changes nothing: the probability stays 30%.

Limits of a positive signal

The starting rate and both signal rates must describe comparable cases. A positive signal alone does not prove the event, and a 10,000-case tree shows expected averages rather than literal fractional objects. If a signal is impossible under both branches, its conditional probability is undefined.

Source: MIT probability lecture notes.

Questions about the updated probability

Why can an accurate detector still produce mostly false signals?

When the event is rare, the much larger group without it can contribute more false signals than true ones.

What is the prior probability?

It is the event rate before observing the signal in the group you are studying.

Do the three inputs need to total 100%?

No. They describe different conditional groups; each input only needs to be between 0 and 100%.

What if the signal never appears?

The probability after that signal is undefined, so the calculator asks you to change the inputs.

Is the outcome tree a simulation?

No. It scales the entered rates to expected counts in 10,000 comparable cases.

Similar calculators

You may find the following calculators on the same topic useful:

Share on social media

If you liked it, please share the calculator on your social media platforms. It`s easy for you and beneficial for the project`s promotion. Thank you!