Bayes' Theorem Calculator

Calculate Conditional Probability

Use Bayes' Theorem to calculate various probabilities using the calculator below.

How to Calculate Using Bayes' Theorem

Bayes' Theorem is a fundamental principle in probability theory that allows us to update our beliefs about an event based on new evidence. It's widely used in various fields, including statistics, machine learning, and decision theory.

Bayes' Theorem Formula

The formula for Bayes' Theorem is:

\[ P(A|B) = \frac{P(B|A) \cdot P(A)}{P(B)} \]

Where:

  • P(A|B) is the posterior probability of A given B
  • P(B|A) is the likelihood of B given A
  • P(A) is the prior probability of A
  • P(B) is the marginal likelihood

Calculation Steps

  1. Identify the prior probability P(A)
  2. Determine the likelihood P(B|A)
  3. Calculate the marginal likelihood P(B)
  4. Apply Bayes' Theorem formula
  5. Interpret the result

Example Calculation

Let's calculate the probability of having a disease given a positive test result:

  • P(D) = 0.01 (1% of the population has the disease)
  • P(T|D) = 0.95 (95% chance of a positive test if you have the disease)
  • P(T|not D) = 0.05 (5% chance of a false positive)

Steps:

  1. Calculate P(T): \[ P(T) = P(T|D) \cdot P(D) + P(T|\text{not }D) \cdot P(\text{not }D) \] \[ P(T) = 0.95 \cdot 0.01 + 0.05 \cdot 0.99 = 0.0595 \]
  2. Apply Bayes' Theorem: \[ P(D|T) = \frac{P(T|D) \cdot P(D)}{P(T)} = \frac{0.95 \cdot 0.01}{0.0595} \approx 0.1597 \]

Therefore, the probability of having the disease given a positive test result is about 15.97%.

Visual Representation

A visual representation can help understand Bayes' Theorem. Here's a diagram showing the probabilities in our example:

P(T) = 0.0595 P(D) = 0.01 P(D|T) ≈ 0.1597

This diagram illustrates the probabilities involved in our example, with the area of each circle proportional to the probability it represents.