# Bayesian Inference Toy Problem

Problem statement: Consider a probabilistic model where there are two states of the world, framed as complimentary events: $$A$$: All chocolates are black and $$A^C$$: 50% of chocolates are black. Let $$p$$ be the prior probability $$P(A)$$ that all chocolates are black. Assume we make an observation of a chocolate with probability $$q$$, independent of $$A$$. Also assume $$0 \lt p,q \lt 1$$. Given the event $$B$$: a black chocolate is observed, what is $$P(A|B)$$?

I used Bayes' Rule to expand $$P(A|B)$$: $$P(A|B) = \frac{P(B|A)P(A)}{P(B)} \\ = \frac{P(B|A)P(A)}{P(B|A)P(A) + P(B|A^C)P(A^C)} \\ = \frac{p^2}{p^2 + (1-p)^2}$$

I'm slightly unclear about the conditional probabilities $$P(B|A)$$ and $$P(B|A^C)$$.

• $$P(B|A)$$ reads as "the probability that a black chocolate is observed given that all chocolates are black." I would interpret this to have a probability of $$p$$ since $$A$$ occurs with probability $$p$$.
• $$P(B|A^C)$$ reads as "the probability that a black chocolate is observed given that 50% of chocolates are black." I would interpret this to have probability $$1-p$$ since $$A^C$$ occurs with probability $$1-p$$.

Are these interpretations to solve $$P(A|B)$$ correct?

• If all chocolates are dark, how is it possible to observe a chocolate that isn't dark? What's the probability of drawing a red ball from an urn given that 50% of the (otherwise identical) balls are red? (In your formulation, is "black chocolate" the same as "dark chocolate?") – Matthew Gunn Feb 12 at 3:11
• @MatthewGunn Sorry for the confusion––I meant for black and dark to be synonymous. I updated the question. – Shrey Feb 12 at 3:18
• Please add the self-study tag. – Xi'an Feb 12 at 5:44
• To repeat @MatthewGunn's comment, "the probability that a black chocolate is observed given that all chocolates are black" is not the probability that all chocolates are black. – Xi'an Feb 12 at 5:47
• What is the relevance of $q$? It is mentioned but not used. I'm not sure of the meaning of "we make an observation of a chocolate with probability $q$, independent of $A$". – CarbonFlambe Feb 14 at 16:49

When you calculate conditional probabilities $$P(B|A),P(B|A^c)$$ etc remember that $$A$$ and $$A^c$$ respectively have already occurred. You'll need to revisit your calculations.
Just to give you an example of what I mean: Let's say you have 20 people in a room and 1 of them is a man with a beard and 19 are women (without a beard). If you choose one person at random then $$P(man) = 1/20$$, $$P(beard) = 1/20$$ but $$P(beard|Man) = 1$$. The problem in the way you calculate conditional probabilities in your example is that you account that only 1 man in the room but you shouldn't!! Given that the chosen person is a man, then the conditional probability of him having a beard is 100% . I hope that's clear now.