# Bayes, three tests, probability patient has disease if exactly two come out positive

I know how to apply Bayes Theorem to determine the likelihood a patient has a given disease if multiple trials return a positive result. In this case, if two trials both return positive:

$$P(\text{User}\mid++) = \frac{P(\text{User})P(+\mid\text{User})^2}{P(\text{User})P(+\mid\text{User})^2+(1 − P(\text{User})) P(+\mid\neg\text{User})^2}$$

However, how could I modify the above formula if one conducts three trials, and exactly two tests come out positive? What would be the likelihood that the patient has the disease then?

I would assume that $_3C_2$ comes into play as well, but I'm lost as to how to incorporate the negative result into the probability calculation.

• So "User" means a patient who has a given disease? – Michael Hardy Sep 18 '18 at 0:28

I would assume that $^3\mathrm C_2$ comes into play as well,
To shorten typesetting, let $U$ be the event of the subject being a user (???), $S$ be the count of positive test results among three tests (which are presumed to be conditionally iid for a given subject, each with conditional probabilities $P(T\mid U)$ and $P(T\mid \neg U)$ ).
\begin{align}\mathsf P(U\mid S=2) &=\dfrac{\mathsf P(S=2\mid U)~\mathsf P(U)}{\mathsf P(S=2\mid U)~\mathsf P(U)+\mathsf P(S=2\mid \neg U)~\mathsf P(\neg U)}\\[1ex]&= \dfrac{^3\mathrm C_2\mathsf P(T\mid U)^2~\mathsf P(\neg T\mid U)~\mathsf P(U)}{^3\mathrm C_2\mathsf P(T\mid U)^2~\mathsf P(\neg T\mid U)~\mathsf P(U)+^3\mathrm C_2\mathsf P(T\mid \neg U)^2~\mathsf P(\neg T\mid\neg U)~\mathsf P(\neg U)}\\[1ex]&= \dfrac{\mathsf P(T\mid U)^2(1-\mathsf P(T\mid U))~\mathsf P(U)}{\mathsf P(T\mid U)^2(1-\mathsf P(T\mid U))~\mathsf P(U)+\mathsf P(T\mid \neg U)^2(1-\mathsf P(T\mid\neg U))(1-\mathsf P(\neg U))}\end{align}