An Example
Here is an example of Bayes’s theorem at work.
We are at the races and betting on hounds. There are six dogs in total. Each one has different winning percentages. The Oddsmakers have established each dog’s individual winning percentages based on races won as follows:
|
Hound |
Percentage of races won |
|
Barrow |
.90 |
|
Huygens |
.80 |
|
Cavalieri |
.60 |
|
Fermat |
.50 |
|
“Fig” |
.30 |
|
Decartes |
.20 |
However it rains and different percentages are calculated for each dog. These will be used as our priors:
|
Hound |
Percentage of races won during rain |
|
Barrow |
.5 |
|
Huygens |
.667 |
|
Cavalieri |
.333 |
|
Fermat |
.333 |
|
“Fig” |
.667 |
|
Decartes |
.833 |
In order to use these prior they must be mutually exclusive and add to one. The following equation is used:
P(q)=p(q)/Si=1p(q i)
Our priors need a sum of one, i.e. Si=1P(q i) = 1. Our new table with the correct priors should look like this:
|
Hound |
% of races won = p(x) |
% of races won during rain = P(q) |
|
Barrow |
.90 |
.15 |
|
Huygens |
.80 |
.20 |
|
Cavalieri |
.60 |
.1 |
|
Fermat |
.50 |
.1 |
|
“Fig” |
.30 |
.2 |
|
Decartes |
.20 |
.25 |
Now our prior probabilities are known and data collected. The likelihood is based on one race. Each race will establish only one winner, so we end up with n = 1 and k = 1. The likelihood of the data based on the observation of the race can be calculated as:
L(x|q) = [n!/k!(n-k)!]p(x)k(1-p(x))n-k
In this case the likelihood will equal the data, due to the nature of the binomial distribution. Now Bayes’s theorem can be applied.
P(q|x) = P(x|q) P(q) / P(x)
· P(x|q) = L(x|q)
· P(x) = L(x1|q ) P(q1) + L(x2|q 2) P(q2) + . . . + L(xn|qn) P(qn) = qi=1 L(xi|qi) P(qi)
With Bayes’s theorem our posterior probabilities are calculated and we have new table:
|
Hound |
Data = p(x) |
Prior =P(q) |
Likelihood |
Prior x Likelihood |
Posterior (rounded) |
|
Barrow |
.90 |
.15 |
.9 |
.135 |
.26 |
|
Huygens |
.80 |
.20 |
.8 |
.16 |
.31 |
|
Cavalieri |
.60 |
.10 |
.6 |
.06 |
.12 |
|
Fermat |
.50 |
.10 |
.5 |
.05 |
.10 |
|
“Fig” |
.30 |
.20 |
.3 |
.06 |
.12 |
|
Decartes |
.20 |
.25 |
.2 |
.05 |
.10 |
The above example is suppose to give you the jist of Bayes’s Theorem. However here is another example, which will help you further understand the use of likelihood in Bayesian estimation: