Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Bayes' Theorem | Probability of Complex Events
Probability Theory Basics
course content

Зміст курсу

Probability Theory Basics

Probability Theory Basics

1. Basic Concepts of Probability Theory
2. Probability of Complex Events
3. Commonly Used Discrete Distributions
4. Commonly Used Continuous Distributions
5. Covariance and Correlation

bookBayes' Theorem

Bayes' theorem is a fundamental concept in probability theory that allows us to update our beliefs or probabilities based on new evidence. We have already considered the law of total probability, Bayes' theorem is very similar to this law. Let's look at the formulation:

Let's provide explanations:

  1. We have to split our space of elementary events into n different incompatible events;
  2. We know that event A results from the stochastic experiment. It means that A has already occurred;
  3. We want to understand which segment H we experimented with by calculating the corresponding conditional probability.

Example

Suppose a diabetes medical test is 90% accurate in detecting a specific disease.
The disease is rare and occurs in only 1% of the population. If a person tests positive for the disease, what is the probability that the person has the disease?

Solution

To solve this problem, it is necessary to consider that the test can be false positive and false negative. This is why we need to use Bayes' theorem.

H₁: The probability of a randomly selected individual having diabetes is 0.01.
H₂: The probability of a randomly selected individual not having diabetes is 0.99.
A: the test result is positive (diabetes is detected by test).
P(A|H₁): the probability that the test detects diabetes and the person is ill equals 0.9 ( true positive result).
P(not A|H₂): the probability that the test doesn't detect diabetes and the person is not ill equals 0.9 (true negative result).
P(A|H₂): the probability that the test detects diabetes and the person is not ill equals 1 - P(not A|H₂) = 0.1 (false positive result).

We have to find P(H₁|A) - the probability that a person is really ill if the test detects diabetes

12345678910111213141516
# Prior probabilities P_diabetes = 0.01 P_no_diabetes = 0.99 # Conditional probabilities P_positive_given_diabetes = 0.9 P_positive_given_no_diabetes = 0.1 # Calculate the delimiter of the expression - probability that test is positive P_positive_test = (P_positive_given_diabetes * P_diabetes) + (P_positive_given_no_diabetes * P_no_diabetes) # Calculate the probability of having diabetes given a positive test result using Bayes' theorem P_diabetes_given_positive = (P_positive_given_diabetes * P_diabetes) / P_positive_test # Print the results print(f'The probability of having diabetes given a positive test is {P_diabetes_given_positive:.4f}')
copy

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 2. Розділ 5
We're sorry to hear that something went wrong. What happened?
some-alt