4.1 Bayes’ Theorem

Formula: \[P(H|D) = \frac{P(D|H)P(H)}{P(D)}\], posterior probability = likelihood * prior / evidence = (likelihood * prior) / marginal likelihood, where \(P(H|D)\) is the posterior probability of hypothesis \(H\) given the data \(D\), \(P(D|H)\) is the likelihood of the data given the hypothesis, \(P(H)\) is the prior probability of the hypothesis, and \(P(D)\) is the marginal likelihood of the data.

Assuming that we are interested in the probability of picking out a yellow fruit that happened to be a pear, i.e., \(p(\text{pear}|\text{yellow})\). Given the following contingency table, we can calculate the posterior probability of picking out a pear given that it is yellow. Namely, \(p(\text{pear}|\text{yellow}) = \frac{p(\text{yellow}|\text{pear})p(\text{pear})}{p(\text{yellow})}\).

TABLE 4.1: Contingency table for Bayesian Thinking
Red Yellow Row totals
Apple 0.3 0.1 0.4
Pear 0.1 0.5 0.6
Column totals 0.4 0.6 1.0