Get startedGet started for free

Swine flu blood test

You go to the doctor about a strong headache. The doctor randomly selects you for a blood test for swine flu, which is suspected to affect 1 in 9,000 people in your city. The accuracy of the test is 99%, meaning that the probability of a false positive is 1%. The probability of a false negative is zero.

Given that you test positive, answer the following questions.

This exercise is part of the course

Foundations of Probability in Python

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Probability of having Swine_flu
P_Swine_flu = 1./9000
# Probability of not having Swine_flu
P_no_Swine_flu = 1 - ____
# Probability of being positive given that you have Swine_flu
P_Positive_g_Swine_flu = ____
# Probability of being positive given that you do not have Swine_flu
P_Positive_g_no_Swine_flu = ____

# Probability of Positive
P_Positive = (____ * ____) + (____ * ____)

# Bayes' rule for P(Swine_flu|Positive)
P_Swine_flu_g_Positive = (____ * ____) / P_Positive

print(P_Swine_flu_g_Positive)
Edit and Run Code