# Beginner Bayesian question - which statement is false?

I'm working my way through Statistical Rethinking as a beginner Bayesian and am struggling with one of the concept-check questions. Book is here but is paywalled, so I'll also link to the solutions manual that has all of the necessary info here, and the question is reproduced in full below.

Suppose there are two species of panda bear. Both are equally common in the wild and live in the sample places. They look exactly alike and eat the same food, and there is yet no genetic assay capable of telling them apart. They differ however in their family sizes. Species A gives birth to twins 10% of the time, otherwise birthing a single infant. Species births twins 20% of the time, ottherwise birthing singleton infants. Assume these numbers are known with certainty, from many years of field research. Now suppose you are managing a captive panda breeding program. You have a newe female panda of unknown species, and she has just given birth to twins. What is the probability that her next birth will also be twins?

If I understand this problem correctly, then what I want is $$p(twins)$$. However, the answer that I'm getting (0.15) doesn't match what's provided in the solutions (0.167).

What I can glean from the question:

• $$p(twins|species A) = 0.1$$
• $$p(twins|species B) = 0.2$$
• $$p(species A) = p(species B) = 0.5$$ (the populations are equally common)

I also make the assumption that twin births are independent (i.e. the fact that the mother had twins immediately before doesn't change the likelihood of twins this time).

I realize the last bit of info I need to answer this question is $$p(species B|twins)$$ (or $$p(species A|twins)$$), so I made the following deduction:

$$p(species B|twins) = \frac{p(twins|species B)}{p(twins|species B)+p(twins|species A)}= \frac{2}{3}$$

I'm pretty sure the above statement is true, although it's mostly based on intuition, because the next question in the concept-check produces the same answer.

However, when I plug these numbers into Bayes' formula I get 0.15 rather than the correct answer of 0.167 (with $$A$$ = $$twins$$ and $$B$$ = $$speciesB$$)

$$p(A) = \frac{p(B)*p(A|B)}{p(B|A)} \therefore\ p(twins) = \frac{p(speciesB)*p(twins|speciesB)}{p(speciesB|twins)} = \frac{0.5*0.2}{\frac{2}{3}} = 0.15$$

This is true even if I use $$B$$ = $$speciesA$$

$$p(A) = \frac{p(B)*p(A|B)}{p(B|A)} \therefore\ p(twins) = \frac{p(speciesA)*p(twins|speciesA)}{p(speciesA|twins)} = \frac{0.5*0.1}{\frac{1}{3}} = 0.15$$

Where did I go wrong?

• You want to check your assumptions with twin births. Indeed for the same mother, it is probably safe to say a past twin birth event has no bearing on a future twin birth event. However, giving a twin birth in the past should influence your belief on which species the mother belongs to, and your numbers currently did not take that into account. Apr 1, 2021 at 19:35

The problem isn't that you have a false statement. It's that you're measuring the wrong quantity. It’s helpful to remember that there are two events here: birth 1 and birth 2. We care about what happens in birth 2, given what we know about birth 1.

You're finding $$p(\textrm{Birth2}=\textrm{twins} \mid \textrm{speciesA})$$ or $$p(\textrm{Birth2}=\textrm{twins} \mid \textrm{speciesB})$$. These are the posterior distributions over $$\textrm{Birth2}$$ given the latent (meaning unobserved) variable $$\textrm{Species}$$. What you really ought to do is use the posterior predictive distribution, which marginalizes out the nuisance variable $$\textrm{Species}$$.

\begin{align} p(\textrm{Birth2}=\textrm{twins} \mid \textrm{Birth1}=\textrm{twins}) &= \sum_{s \in \textrm{Species}} \underbrace{p(\textrm{Birth2}=\textrm{twins} \mid s)}_{\text{next birth given species}} \times \underbrace{p(s \mid \textrm{Birth1}=\textrm{twins})}_{\text{species given previous birth}} \\ &= p(\textrm{Birth2}=\textrm{twins} \mid a) p(a \mid \textrm{Birth1}=\textrm{twins}) + p(\textrm{Birth2}=\textrm{twins} \mid b) p(b \mid \textrm{Birth1}=\textrm{twins}) \\ &= 0.1 \times \frac{1}{3} + 0.2 \times \frac{2}{3} \\ &=\frac{1}{6} \\ &\approx 0.167 \end{align}

This expression measures your belief about the second birth, given the first. It handles both cases of what $$\textrm{Species}$$ could be.

Note that you already have computed the relevant quantities properly by Bayes's rule; well done!

• Brilliant! Thanks for writing this out with such detail - it definitely helped to see all the steps. Apr 2, 2021 at 8:58

You are very close to the answer, but there is a key word in the quantity that is being asked of you to calculate.

You have a new female panda of unknown species, and she has just given birth to twins. What is the probability that her next birth will also be twins?

That is, you are not interested in the evidence, $$Pr(\text{twins})$$ but the posterior predictive probability $$Pr(X_{2} = \text{twins} \ | X_{1} = \text{twins}),$$ where $$X_{1}$$ is the "first birth", i.e. your only observation for this panda bear, and $$X_{2}$$ is the second birth in the future.

In other words, calculate:

$$\sum_{\text{all species i}} Pr(X_{2} = \text{twins} \ | \ \text{species i}) \times Pr(\text{species i} \ | \ X_{1} =\text{twins}) .$$

Note that the last term in the summation is the posterior probability that you have already calculated.

• Excellent, thanks @aranglol! This was definitely helpful in figuring out my confusion, but I'm going to give the green check to Arya for the extra steps that they included. Apr 2, 2021 at 8:59