Learn

Imagine that you are a patient who has recently tested positive for strep throat. You may want to know the probability that you HAVE strep throat, given that you tested positive:

P(ST+)P(ST \mid +)

To calculate this probability, we will use something called Bayes Theorem, which states the following:

P(BA)=P(AB)P(B)P(A)P(B \mid A) = \frac{P(A \mid B) \cdot P(B)}{P(A)}

Using Bayes’ theorem:

P(ST+)=P(+ST)P(ST)P(+)P(ST \mid +) = \frac{P(+ \mid ST) \cdot P(ST)}{P(+)}

We know:

P(+ST)=0.85P(+ \mid ST) = 0.85

We also know:

P(ST)=0.20P(ST) = 0.20

What about P(+)? Is this something we know? Well, let’s think about this. There are four possible outcomes:

  • Having strep throat and testing positive
  • Having strep throat and testing negative
  • Not having strep throat and testing positive
  • Not having strep throat and testing negative

We only care about the two outcomes where a patient tests positives for P(+). Therefore, we can say:

P(+)=P(ST and +)+P(NO ST and +)P(+)=0.17+.016P(+)=0.186\begin{aligned} P(+) = P(\text{ST and +}) + P(\text{NO ST and +}) \\ P(+) = 0.17 + .016 \\ P(+) = 0.186 \\ \end{aligned}

Finally, if we plug all of these into the Bayes’ theorem formula, we get:

P(ST+)=0.850.200.186=0.914P(ST \mid +) = \frac{0.85 \cdot 0.20}{0.186} = 0.914

There is a 91.4% chance that you actually have strep throat given you test positive. This is not obvious from the information outlined in our tree diagram, but with the power of Bayes theorem, we were able to calculate it!

Let’s practice some more of this in the questions below.

Instructions

Find:

P(ST)P(ST \mid -)
Click to see answer! The final answer is 0.037

Find:

P(NO ST+)P(\text{NO ST} \mid +)
Click to see answer! The final answer is 0.086

Find:

P(NO ST)P(\text{NO ST} \mid -)
Click to see answer! The final answer is 0.963

Could you try an alternative method here as well?


Take this course for free

By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.
Already have an account?