# Practice with Bayes

Dec 5, 2020 · 4 min read

How to use trees to solve Bayes problems

# Example 1:

A standard poker deck is shuffled and the card on the top is removed. What is the probability the second card is a Queen?

There are 4 queens in a 52 card card deck. 48 of the cards are not queens (52–4). If the first card is left out of the deck during the second draw, the second draw will be drawn from 51 cards. In the second draw your chance of getting a queen is 3/51. Which means 48 out of 51 cards will not be queen. If the queen was not pulled out the first time, you will have a 4 out of 51 chance of drawing a queen and a 47 out of 51 chance of drawing a card other than a queen. The probability the second card is a queen:

(4/52) x (3/51) + (48/52) x (4/51)

# Example 2:

An advertising agency is studying television viewing of married couples. It is determined the men are watching TV 62% of the time. It has also been determined that when the men are watching TV 40% of the time their husbands are also watching. When the men are not watching TV, 30% of the time the husband is watching television. Find the probability that if the husband is watching tv their partners are also watching TV.

(.62)(.4) / ((.62)(.4) + (.38)(.3))

# Example 3:

A medical test is used to diagnose a disease. The test has a false positive rate of 4% (4% of people without disease get a positive result). The test has a false negative of 7%. And 12% of the population has the disease. 1 — probability a person receives a positive test result? 2 — probability a person has the disease if they receive a positive result?

1 — (.12)(.93) + (.88)(.04) 2 — (.12)(.93) / (.12)(.93) + (.88)(.04)

# Example 4:

Condoms are produced by 2 companies, Trojan and Not Trojan. Trojan produces 67% of the condoms with a defective rate of 2%. While the company, Not Trojan, has a defective rate of 7%. If a condom is randomly selected and found to be defective what is the probability it was Trojan?

(.67)(.02) / ((.67)(.02) + (.33)(.07))

# Example 5:

After listening to the Serial podcast tale of Adnan and murder of Hae Min Lee you decide to learn more about trials. Suppose the probability a defendant is convicted, given guilty, is 94, and the probability the defendant is acquitted, given innocent, is 94%. Also 95% of all defendants truly are guilty. Find the probability the defendant was innocent given the defendant is convicted.

(.05)(.06) / ((.05)(.06) + (.95)(.94))

# Example 6:

A population of voters contains 35% Republicans and 65% Democrats. It is reported that 40% of Republicans and 60% of Democrats favor an election issue. A person chosen at random from this population is found to favor the issue. Find the conditional probability that this person is a Democrat.

(.65)(.6) / ((.65)(.6) + (.35)(.4))

# Example 7:

Elizabeth Holmes found out that 17% of people will develop cancer at some point. A person with cancer has a 95% chance of a positive test result. Someone WITHOUT cancer has a 6% chance of getting a false positive test result. What is the probability that one has cancer given a positive result?

You might have done (.17)(.95) / ((.17)(.95) + (83)(.06)), but you’d be wrong because Elizabeth Holmes is a liar who created the Toxic work environment Theranos. Don’t trust testing that comes from Elizabeth Holmes.

## Analytics Vidhya

Analytics Vidhya is a community of Analytics and Data…

Written by

## Raizel Bernstein

Aspiring Data Scientist

## Analytics Vidhya

Analytics Vidhya is a community of Analytics and Data Science professionals. We are building the next-gen data science ecosystem https://www.analyticsvidhya.com

Written by

## Raizel Bernstein

Aspiring Data Scientist

## Analytics Vidhya

Analytics Vidhya is a community of Analytics and Data Science professionals. We are building the next-gen data science ecosystem https://www.analyticsvidhya.com

## The Art Gallery Theorem

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app