Bayes' rule, named after the English mathematician Thomas Bayes, is a rule for computing conditional probabilities.
Let and be two events. Denote their probabilities by and and suppose that both and . Denote by the conditional probability of given and by the conditional probability of given . Bayes' rule states that:
Bayes' rule is easily proved as follows:
Using the conditional probability formula:and:The second formula is re-arranged as follows:which is then plugged into the first formula:
The following example shows how Bayes' rule can be applied in a practical situation:
Example An HIV test gives a positive result with probability 98% when the patient is indeed affected by HIV, while it gives a negative result with 99% probability when the patient is not affected by HIV. If a patient is drawn at random from a population in which 0,1% of individuals are affected by HIV and he is found positive, what is the probability that he is indeed affected by HIV? In probabilistic terms, what we know about this problem can be formalized as follows:Furthermore, the unconditional probability of being found positive can be derived using the law of total probability:Therefore, using Bayes' rule:Therefore, even if the test is conditionally very accurate, the unconditional probability of being affected by HIV when found positive is less than 10 per cent!
The quantities involved in Bayes' rule:often take the following names:
is called prior probability or, simply, prior;
is called conditional probability or likelihood;
is called marginal probability;
is called posterior probability or, simply, posterior.
Below you can find some exercises with explained solutions:
Exercise set 1 (use Bayes' rule to compute posterior probabilities)
Most learning materials found on this website are now available in a traditional textbook format.