3
$\begingroup$

I am self-learning statistics, and I have a question about how to do the following problem:


There are two species of panda bear, A and B. Both are equally common in the wild and live in the same places. A veterinarian has a new genetic test that can identify the species of a panda. But the test, like all tests, is imperfect. This is the information you have about the test:

• The probability it correctly identifies a species A panda is 0.8. • The probability it correctly identifies a species B panda is 0.65.

The vet administers the test to your panda and tells you that the test is positive for species A. Compute the posterior probability that your panda is species A.


I wish to calculate P(species=A | test=A), by using the Bayes theorem and calculate the prior, P(test=A).

I am confused about the test on species B. How to calculate the prior?

$\endgroup$
  • $\begingroup$ I think you are missing some information. $\endgroup$ – user2974951 Feb 11 '19 at 13:38
1
$\begingroup$

Bayes' theorem gives

\begin{equation} \mathrm{prob}(\mathrm{species} = A | \mathrm{test} = A, \mathcal{I}) = \frac{\mathrm{prob}(\mathrm{test} = A | \mathrm{species} = A, \mathcal{I}) \: \mathrm{prob}(\mathrm{species} = A | \mathcal{I})}{\mathrm{prob}(\mathrm{test} = A | \mathcal{I})} \end{equation}

with $\mathcal{I}$ being the problem information. By the marginalisation and product rules we can expand the denominator as

\begin{align} \mathrm{prob}(\mathrm{test} = A | \mathcal{I}) &= \sum_{s \in \{A, B\}} \mathrm{prob}(\mathrm{test} = A, \mathrm{species} = s | \mathcal{I}) \\ &= \sum_{s \in \{A, B\}} \mathrm{prob}(\mathrm{test} = A | \mathrm{species} = s, \mathcal{I}) \: \mathrm{prob}(\mathrm{species} = s | \mathcal{I}) \end{align}

From the problem information we have

\begin{align} \mathrm{prob}(\mathrm{test} = A | \mathrm{species} = A, \mathcal{I}) &= 0.8 \\ \mathrm{prob}(\mathrm{test} = B | \mathrm{species} = B, \mathcal{I}) &= 0.65 \\ \mathrm{prob}(\mathrm{species} = A | \mathcal{I}) &= 0.5 \\ \mathrm{prob}(\mathrm{species} = B | \mathcal{I}) &= 0.5 \end{align}

and from the second line

\begin{equation} \mathrm{prob}(\mathrm{test} = A | \mathrm{species} = B, \mathcal{I}) = 0.35 \end{equation}

So the answer is

\begin{align} \mathrm{prob}(\mathrm{species} = A | \mathrm{test} = A, \mathcal{I}) &= \frac{0.8 \cdot 0.5}{0.8 \cdot 0.5 + 0.35 \cdot 0.5} \\ &= \frac{16}{23} \simeq 0.696 \end{align}

| cite | improve this answer | |
$\endgroup$
  • 1
    $\begingroup$ This is a case where the answer make the question much more interesting! Thank you, @CarbonFlambe. :) $\endgroup$ – Peter Leopold Feb 15 '19 at 14:52
  • $\begingroup$ Thank you for the kind words, @PeterLeopold. It's a pleasure. :) $\endgroup$ – CarbonFlambe--Reinstate Monica Feb 15 '19 at 15:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.