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?