Bayes' Rule
For two random events \(A\) and \(B\), the Bayes' rule is expressed as follows:
\[
Pr[A|B] = \frac{Pr[B|A]Pr[A]}{Pr[B]}
\]
where
- \(Pr[A|B]\) is the probability of occurrence of event \(A\) given that the event \(B\) has already happened.
- \(Pr[B|A]\) is the probability of occurrence of event \(B\) given that the event \(A\) has already happened.
- \(Pr[A]\) is the probability of occurrence of event \(A\).
- \(Pr[B]\) is the probability of occurrence of event \(B\).
Imagine that we are testing a person for disease. Let \(A\) be the event that the person has the disease and \(B\) be the event that the person is tested positive. In this case:
- \(Pr[A|B]\) is the probability that the person indeed has the disease given that the test is positive. In real-life, we are interested in estimating this probability.
- \(Pr[B|A]\) is the probability that a diseased person is tested positive. It is known as the sensitivity of the test, which is typically specified by the scientist who propose the test.
- \(Pr[A]\) is the probability that a randomly chosen person has the disease. It is the general prevalence of the disease.
- \(Pr[B]\) is the probability that a randomly chosen person is tested positive. Its computation comprises of two possibilities: a diseased person tested as positive as well as healthy person tested as positive. Thus, one needs to use the law of total probability to compute \(Pr[B]\) as follows.
\[
Pr[B] = Pr[B|A]Pr[A] + Pr[B|\bar{A}]Pr[\bar{A}]
\]