# Bayes theorem question

A car accident occurs and of the 5 witnesses, 4 of them saw a green car, and 1 of them saw a yellow car. In the universe, 85% of cars are yellow and 15% of cars are green. Witnesses report correctly 2/3 time. What is the probability that the car is green?

So I'm trying to figure out P(G | D) where G is green and D is the data.

So... the way I think of it is that I have to weight the probability of the data given that the car is green against the total probability of the data (true positives + false positives)

In my mind, that's something like

$\frac{true-positive}{true-positive + false-positive}$

The likelihood of a true positive is: $\frac{2}{3}^4 * \frac{1}{3} * 0.15 = 0.0098765432$ right?

Is the false positive: $\frac{1}{3}^4 * \frac{2}{3} = 0.00699588477$

Am I on track? Am I using the word likelihood correctly?

We are given $P(G)=15\%$ prior probability and are looking for $P(G|data)$ posterior probability.

By Bayes' Theorem we have

$P(G|data) = \frac{P(data|G)P(G)}{P(data)}$

By law of total probability we have

$P(G|data) = \frac{P(data|G)P(G)}{P(data|G)P(G) + P(data|Y)P(Y)}$

Observe that the data is that there are 4 correct and 1 incorrect if it was green, and vice-versa (usage?) otherwise. Hopefully, one can see the relevance of the binomial distribution here.

Thus,

$P(data|G) = \binom{5}{4}(2/3)^4(1/3)^1 \tag{**}$

# Appendix

Actually $$data := \{\text{W1 reports Y} \cap \text{W2 reports G} \cap \text{W3 reports G} \cap \text{W4 reports G} \cap \text{W5 reports G}\}$$

$$\cup \{\text{W1 reports G} \cap \text{W2 reports Y} \cap \text{W3 reports G} \cap \text{W4 reports G} \cap \text{W5 reports G}\}$$

$$\cup \dots \cup \{\text{W1 reports G} \cap \text{W2 reports G} \cap \text{W3 reports G} \cap \text{W4 reports G} \cap \text{W5 reports Y}\}$$

Thus, if the car is green then

$$data = data_a \tag{*}$$

where

$$data_a := \{\text{W1 is not right} \cap \text{W2 is right} \cap \text{W3 is right} \cap \text{W4 is right} \cap \text{W5 is right}\}$$

$$\cup \{\text{W1 is right} \cap \text{W2 is not right} \cap \text{W3 is right} \cap \text{W4 is right} \cap \text{W5 is right}\}$$

$$\cup \dots \cup \{\text{W1 reports G} \cap \text{W2 reports G} \cap \text{W3 is right} \cap \text{W4 is right} \cap \text{W5 is not right}\}$$

and $(*)$ is showing the equivalence of the events which is

$\forall \omega$, sample points $\in \Omega$ the sample space, we have

$$\omega \in data \iff \omega \in data_a$$

if $\omega \in G$

where

$G, Y, data, data_a, \{\text{Wi reports G}\}, \{\text{Wi reports Y}\}$ are events, that is, subsets of the sample space $\Omega$.

So really, the justification for $(**)$ is that

$P(data|G) = P(data_a|G)$

because

$P(data \cap G) = P(data_a \cap G) \tag{***}$

because of (*).

Observe that if $\omega \in Y$, then $(***)$ is simply $0=0$

I calculate a 58.5 % chance that the car is green. See that attached image

Note that this is the same result that you got, except you didn't normalize your .009876 and .0069958. I normalized every step, but you don't have to every step. You do need to normalize at the end though

I like to think of Bayes theorem as a "Normalized Weighted Average", I have a blog post about that here http://www.fairlynerdy.com/an-intuitive-guide-to-bayes-theorem/

Edit to describe normalizing a bit

here is the bayes theorem equation with some labels. You did the prior and the likelihood, but not the normalizing constant. That makes the total probability of all the outcomes sum to 1.0 at the end

In this case the normalizing constant is the sum of all the probabilities given your results, which were 4 green witnesses, 1 yellow. That sum is (.009876 + .006995) so the probability the car is green is .009876 / (.009876 + .006995) = 58.5%

• 'Everything starts out with an initial probability' - this is more of the bayesian interpretation of probability I think?
– BCLC
Jun 5 '17 at 5:57
• I would agree that "Everything starts out with an initial probability" is a bayesian intrepretation. I'll be honest that there are probably some subtleties that I don't completely understand in the difference between bayesian and frequentist Jun 5 '17 at 6:01
• Neither did I at first when I encountered this 2 years ago. You can have a look at my previous questions if you want if it would be helpful
– BCLC
Jun 5 '17 at 6:04
• What is normalizing? How did you get this number? Jun 5 '17 at 14:08
• Normalizing means dividing by the total probability to get results that sum to 1. In this case .5854 = .009876 / (.009876 + .0069958) and .4146 = .0069958 / (.009876 + .0069958) Basically .009876 is the probability that the car is green and that 4 people will say it is green and 1 person will say it is yellow (will say it in the future) However with bayes those events already occurred, so we throw out all the other probabilities where you didn't get 4 green and 1 yellow answer from the witnesses Jun 6 '17 at 2:32