# Bayes’ theorem

This online calculator calculates posterior probabilities according to Bayes’ theorem.

This online calculator calculates posterior probabilities according to Bayes’ theorem. It can be used as a solver for Bayes' theorem problems. To use it, you need to input the "probability tree" configuration. Below the calculator, you can find examples of how to do this as well theory recap.

### Theory recap

For a quick theory recap, we need some formulas.

Definition: The conditional probability of an event A, given that event B has occurred, is defined as

, given that

Definition: Two events are called independent if and only if .

Definition: Two events A and B are mutually exclusive if and they are called possible if

Theorem: Two possible mutually exclusive events are always dependent (that is, not independent).

Theorem: Two possible independent events are not mutually exclusive.

Definition: Let be a set and let be a collection of subsets of . The collection is called a partition of if

,

for

Theorem: If the events constitute a partition of the sample space S and for , then for any event A in S

Theorem: If the events constitute a partition of the sample space S and for , then for any event A in S such that ,

This theorem is called **Bayes' Theorem**. is called **prior probability**, is called **posterior probability**.

In probability theory and statistics, Bayes’ theorem (aka Bayes’ law or Bayes' rule) deals with so-called backward conditional probabilities. It describes the probability of an event based on prior knowledge of conditions related to the event.

It is handy when we have a two-stage process and can only access the second stage's outcomes while the first stage is hidden. With Bayes' theorem, we can predict this hidden first stage. Consider this example from wikipedia:

### Example

Problem: Suppose a test for using a particular drug is 99% sensitive and 99% specific. The test will produce 99% true positive results for drug users and 99% true negative results for non-drug users. Suppose that 0.5% of people are users of the drug. What is the probability that a randomly selected individual with a positive test is a user?

How to use the calculator:

- Select default data in the table and delete it (click on the top checkbox to select all, then click on the "bin" icon on a table header).
- Add probability tree configuration.

After that, you will get the table with all backward conditional probabilities. The row which reads *Probability of 'User' given 'Positive test' has occurred* is the answer, and it is 0.3322.

So, we are not actually interested in the second stage outcome - test outcome, but we are interested in the first stage outcome - is an individual user or not. And Bayes' theorem gives us an answer - there is only 0.3322 probability. Why? Even though the test appears to be highly accurate, the number of non-users is large compared to the number of users. The number of false positives outweighs the number of true positives.

#### Ähnliche Rechner

**#Bayes #math #Probability Bayes Bayes’ theorem conditional probability Math probability probability theory Statistics

**

**PLANETCALC, Bayes’ theorem

## Kommentare