The Bayes Formula

Dated Sep 29, 2017; last modified on Sun, 14 Mar 2021

The Formula

By definition…

$$ \mathbb{P}(A) = \mathbb{P}(A \cap B) + \mathbb{P}(A \cap B^{c}) $$

From conditional probability

$$ \mathbb{P}(A) = \mathbb{P}(A|B) \ \mathbb{P}(B) + \mathbb{P}(A|B^c) \ \mathbb{P}(B^c) $$

Therefore

$$ \mathbb{P}(B|A) = \frac{ \mathbb{P}(B \cap A) }{ \mathbb{P}(A) } $$ $$ = \frac{ \mathbb{P}(A|B) \mathbb{P}(B) }{ \mathbb{P}(A|B) \ \mathbb{P}(B) + \mathbb{P}(A|B^c) \ \mathbb{P}(B^c) } $$

Switching the roles of the events is convenient because in many problems, one of the conditional probabilities is easier to calculate.

Exercise: Do you have a rare disease?

95% of patients with the disease test positive. 2% of patients without the disease also test positive. 1 in 1,000 people have the disease. If your test result is positive, what is the probability that you have the disease?

Let \(A\) be the event that the test comes back positive, and let \(B\) be the event that you have the disease.

$$ \mathbb{P}(B|A) = \frac{ (.95)(.001) }{ (.95)(.001) + (.02)(.999) } = .045 $$

Practically speaking, for a test to be useful, then the probability of a false positive must be less than the fraction of people that have the disease.