# Probability Question with Bayes Theorem

There are 2 companies, A and B. A pollutes 1/10 of the time while B pollutes 9/10 of the time. The difference between the discharge from the companies is that A usually has twice as many white jugs as black jugs while B has the exact reversed proportions.

Given a discharge with order - b, b, w, b, w, w, b, b, b, w, b - how likely is it that company A is the polluter?

I'm not sure if I'm plugging in things into Bayes Thm formula correctly, $Pr(A|B) = \frac{Pr(B|A)Pr(A)}{Pr(B)}$

$Pr((b,b,w,b,w,w,b,b,b,w,b)|company A) = \frac{Pr(company A|b,b,w,b,w,w,b,b,b,w,b)Pr(b,b,w,b,w,w,b,b,b,w,b)}{Pr(company A)}$

With $Pr(company A) = 1/10$, but I'm not sure how to calculate $Pr(company A|b,b,w,b,w,w,b,b,b,w,b)$ and $Pr(b,b,w,b,w,w,b,b,b,w,b)$. Also, once I have those calculations, do I just plug them in? I remember having to use to the law of total probability calculation but not sure how that factors in here.

Thanks!

• They may be asking you for the $\Pr(\text{company A is guilty}\vert \text{given the pattern of containers observed})$. You can calculate the $\Pr(\text{white container}\vert \text{co. A})= \frac{2}{3}.$ And $\Pr(\text{black container}\vert \text{co. A})= \frac{1}{3}.$ So now the numerator will be $\Pr(\text{pattern observed}\vert \text{co. A})$, which could be the probability of an ordered set of Bernoulli trials. Commented Feb 17, 2017 at 21:19

it's in the other direction. Let $X=(b,b,w,b,w,w,b,b,b,w,b)$. What you need is $Pr(A|X)$ as $X$ is given and the question is about the likely of being $A$. So you must use $$Pr(A|X)=\frac{Pr(X|A)Pr(A)}{Pr(X)}$$ where, using total probabilities $$Pr(X)=Pr(X|A)Pr(A)+Pr(X|B)Pr(B)$$ Also, $Pr(X|some\_company)$ is given by the proportion of black and white jugs. Said this we have that $Pr(b|A)=\frac{1}{3},Pr(w|A)=\frac{2}{3},Pr(b|B)=\frac{2}{3},Pr(w|B)=\frac{1}{3}$
First, it should be clear that the order of jug color is irrelevant, and that the only aspect of the data that is relevant (i.e. the "sufficient statistic") is the number of jugs of a particular color, say white. Thus, your data contains $n = 11$ jugs and $X = 4$ are white.
For convenience, let us define event $A$ to indicate that "Company A" is the polluter of the observed sample, and similarly $B$ indicates that "Company B" was the polluter. The prior probability (before you observed the data) is given as $$\Pr[A] = 1/10,$$ and similarly $\Pr[B] = 1 - \Pr[A] = 9/10$. We are also told that, given $A$ pollutes, the probability distribution of the number of white jugs $X$ is binomial with parameters $n$ and $p_A = 2/3$, whereas given $B$ pollutes, the probability distribution is binomial with parameters $n$ and $p_B = 1/3$; i.e., $$\Pr[X = x \mid A] = \binom{n}{x} (2/3)^x (1/3)^{n-x}, \quad x = 0, 1, \ldots, n, \\ \Pr[X = x \mid B] = \binom{n}{x} (1/3)^x (2/3)^{n-x}, \quad x = 0, 1, \ldots, n.$$ What we want to determine is the posterior probability $$\Pr[A \mid X = 4];$$ that is to say, given you observed the data, what is the chance $A$ generated it? Now the rest is simply an application of Bayes' theorem: $$\Pr[A \mid X = 4] = \frac{\Pr[X = 4 \mid A]\Pr[A]}{\Pr[X = 4]}.$$ The quantities in the numerator are easily calculated, but we don't yet have the denominator, which by the law of total probability, is $$\Pr[X = 4] = \Pr[X = 4 \mid A]\Pr[A] + \Pr[X = 4 \mid B]\Pr[B].$$ Thus we calculate $$\Pr[X = 4 \mid A] = \binom{11}{4}(2/3)^4 (1/3)^7 = \frac{1760}{59049}, \\ \Pr[X = 4 \mid B] = \binom{11}{4}(1/3)^4 (2/3)^7 = \frac{14080}{59049},$$ hence $$\Pr[A \mid X = 4] = \frac{(1760)(1/10)}{(1760)(1/10)+(14080)(9/10)} = \frac{1}{73} \approx 0.0136986.$$ Note that this result makes intuitive sense: the prior probability of $A$ is only $0.1$, and when $A$ occurs, the pollution tends to have more white jugs than black. Given that you observed a result that had more black jugs than white, your posterior belief about the likelihood of $A$ should be even lower than the prior belief.
• The count of white jugs in any order among eleven releases, is binomially distributed, however, the given discharge is in a specified order. The conditional probability of 4 white jugs and 7 black jugs in a particular order when given the company ($C=c$) is $$\mathsf P(W\mid C=c)^4\mathsf P(W^\complement \mid C=c)^7$$ Though fortuitously the binomial coefficients cancel in your answer, Commented Feb 18, 2017 at 6:40