Saturday, July 21, 2012

Bayes Rule again

Let's grant that we order banana trees from two countries; Guatemala and Honduras.

60 percent of the trees ordered are from Guatemala, so the other 40 percent is from Honduras. 6 percent of the trees from Guatemala have tarantulas on them, and only 3 for Honduras.

Question: What is the probability of the trees being from Guatemala given that there are tarantulas on them?

So we're looking for "Pr(G/T) = ?". The equation will look like the following:

Pr(G/T) = Pr(G/b) * Pr(T/G) / Pr(G/b) * Pr(T/G) + Pr(~G/b) * Pr(T/~G)

"Pr(G/b)" is the prior probability of G given our background information. I decided to add in the "b" because it looks like a lot of people tend to do that. In this scenario there are two options; Guatemala and Honduras. Since there are only two, then "~G" can only be Honduras as there are no alternative possibilities. So Pr(~G/b) = the prior probability of Honduras given our background info.

Now let's plug in some numbers.

(1) Pr(G/b) = .6 since 60 percent of the trees come from Guatemala.
(2) Pr(T/G) = .06 since only 6 percent of Guatemalan trees have tarantulas.
(3) Pr(G/b) * Pr(T/G) = .036
(4) Pr(~G/b) = .4 since 40 percent of the trees come from Guatemala.
(5) Pr(T/~G) = .03 since only 3 percent of Honduran trees have tarantulas.
(6) Pr(~G/b) * Pr(T/~G) = .012
(7) .036 + .012 = .048
(8) .036 / .048 = .75

The final answer is .75 which means the probability of the trees being from Guatemala given tarantulas is 75 percent.

This is pretty simple stuff, but this elementary use of Bayes is still useful to know. 

I found this example (Or something like it) in Ian Hacking's book Intro to Probability and Inductive Logic.

No comments:

Post a Comment