Bayes rule exercises: part 3

1. Picking a random student

Suppose you have a school with 100 students. Out of those 55 study math (event A), 25 study physics (event B), and 20 study both, as illustrated in the Venn diagram below:

statistics-for-beginners-bayes-rule-3-task-1-1

Now what’s the probability that a student picked at random studies math GIVEN that we know he studies physics?

Using the definition:

P(A|B) = P(A∩B) / P(B)

P(A|B) = 20 / 25

P(A|B) = 0.8

So the probability is 80%. Here’s what is going on: we are basically dividing the number of students who study both math and physics by the total number of students who study physics. This will give us the probability that, by picking a student at random and verifying that he studies physics, he also studies maths.

Source: http://www.programminglogic.com/bayes-theorem-with-examples/

2. Bowel syndrome diagnostics

Suppose you are a hospital manager, and you are considering the use of a new method to diagnose a rare form of bowel syndrome. You know that only 0,1% of the population suffers from that disease. You also know that if a person has the disease, the test has 99% of chance of turning out positive. If the person doesn’t have the disease, the test has a 98% chance of turning negative.

How feasible is this diagnostics method? That is, given that a test turned out positive, what are the chances of the person really having the disease?

Let’s say that event DIS is having the disease, and event POS is getting a positive test. To solve the problem we want to find P(DIS|POS). The description of the problem tells us that:

P(DIS) = 0.001 (population with the disease)

P(DIS') = 0.999 (population without the disease, so complement of event DIS)

P(POS|DIS) = 0.99 (positive test given patient has disease)

P(POS|DIS') = 0.01 (positive test given patient doesn't have disease)

P(POS'|DIS) = 0.02 (negative test given patient has disease)

P(POS'|DIS') = 0.98 (negative test given patient doesn't have the disease)

Bayes’ theorem is the following:

P(DIS|POS) = P(POS|DIS) P(DIS) / P(POS)

So we are just missing P(POS).

P(POS) = P(DIS)P(POS|DIS) + P(DIS')P(POS|DIS')

P(POS) = 0.001 * 0.99 + 0.999 * 0.02

P(POS) = 0.02097

Now we can apply Bayes’ theorem:

P(DIS|POS) = 0.99 * 0.001 / 0.02097 = 0.0472103

In other words, given the test turned out to be positive, the person only has a chance of 4.7% of actually having the disease. Clearly this is not a feasible method for diagnosing the rare disease.

Important Note: As long as you know the basic conditional probability rule you don’t really need to know Bayes’ theorem to solve any problem. After all his theorem only re-arranges the original rule. For example, in the problem above you could have solved it using the condition probability rule:

P(DIS|POS) = P(DIS ∩ POS) / P(POS)

You would just need to remember that you cac find the intersection of POS and DIS by using this:

P(DIS ∩ POS) = P(POS|DIS) P(DIS)

So why is Bayes’ theorem important if we don’t need it? Well, you don’t need it for problems like the above one. However, there are many classes of problems that can be understood and solved much more easily applying Bayes’ theorem. I’ll talk about it next.

Source: http://www.programminglogic.com/bayes-theorem-with-examples/

3. Treasure in the sea

“It’s believed that a treasure will be in a certain sea area with probability p = 0.4. A search in that area will detect the wreck with probability d = 0.9 if it’s there. What’s the posterior probability of the treasure being in the area when a search didn’t find anything?”

The author uses the odds form to solve the problem.

Posterior odds = (0.4)(0.1) / (0.6)(1) = 1/15

And to transform it back to a probability we simply do 1 / (1+15) = 1/16

Source: http://www.programminglogic.com/bayes-theorem-with-examples/

4. Credit card usage

The Gallup organization randomly selects an adult American for a survey about credit card usage. Use subjective probabilities to estimate the following.

  1. What is the probability that the selected subject is a male?
  2. After selecting a subject, it is later learned that this person was smoking a cigar during the interview. What is the probability that the selected subject is a male?
  3. Which of the preceding two results is a prior probability? Which is a posterior probability?

  1. Roughly half of all Americans are males, so we estimate the probability of selecting a male subject to be 0.5. Denoting a male by M, we can express this probability as follows: P(M) = 0.5.
  2. Although some women smoke cigars, the vast majority of cigar smokers are males. A reasonable guess is that 85% of cigar smokers are males. Based on this additional subsequent information that the survey respondent was smoking a cigar, we estimate the probability of this person being a male as 0.85. Denoting a male by M and denoting a cigar smoker by C, we can express this result as follows: P(M | C) = 0.85.
  3. In part (a), the value of 0.5 is the initial probability, so we refer to it as the prior probability. Because the probability of 0.85 in part (b) is a revised probability based on the additional information that the survey subject was smoking a cigar, this value of 0.85 is referred to a posterior probability

Source: http://faculty.washington.edu/tamre/BayesTheorem.pdf

5. Orange County

In Orange County, 51% of the adults are males. (It doesn't take too much advanced mathematics to deduce that the other 49% are females.) One adult is randomly selected for a survey involving credit card usage.

  1. Find the prior probability that the selected person is a male.
  2. It is later learned that the selected survey subject was smoking a cigar. Also, 9.5% of males smoke cigars, whereas 1.7% of females smoke cigars (based on data from the Substance Abuse and Mental Health Services Administration). Use this additional information to find the probability that the selected subject is a male.

Let's use the following notation:

  • M = male
  • M = female (or not male)
  • C = cigar smoker
  • C = not a cigar smoker.
  1. Before using the information given in part b, we know only that 51% of the adults in Orange County are males, so the probability of randomly selecting an adult and getting a male is given by P(M) = 0.51.
  2. Based on the additional given information, we have the following:

    P(M) = 0.51 because 51% of the adults are males
    P(M) = 0.49 because 49% of the adults are females (not males)
    P(C|M) = 0.095 because 9.5% of the males smoke cigars (That is, the probability of getting someone who smokes cigars, given that the person is a male, is 0.095.)
    P(C|M) = 0.017 because 1.7% of the females smoke cigars (That is, the probability of getting someone who smokes cigars, given that the person is a female, is 0.017.)

    Let's now apply Bayes' theorem by using the preceding formula with M in place of A, and C in place of B. We get the following result:

    P(M|C) = (P(M)*P(C|M)) / ([P(M)*P(C|M)] + [P(M)*P(C|M)]) = (0.51*0.095) / ([0.51*0.095] + [0.49*0.017]) = 0.85329341 = 0.853 (rounded)

    Before we knew that the survey subject smoked a cigar, there is a 0.51 probability that the survey subject is male (because 51% of the adults in Orange County are males). However, after learning that the subject smoked a cigar, we revised the probability to 0.853. There is a 0.853 probability that the cigar−smoking respondent is a male. This makes sense, because the likelihood of a male increases dramatically with the additional information that the subject smokes cigars (because so many more males smoke cigars than females).

Source: http://faculty.washington.edu/tamre/BayesTheorem.pdf

If you like my articles,