MulaiMulai sekarang secara gratis

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.

Latihan ini adalah bagian dari kursus

Foundations of Probability in Python

Lihat Kursus

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# 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 dan Jalankan Kode