# Probability and genetics - Bayes' theorem

Britney can be homozygous $$HH$$ or heterozygous $$Hh$$ with equal probability. Hemophilia is a mostly inherited genetic disorder. A test to detect a dominant allele $$h$$, responsible for the disorder, is carried out. The test has $$85\%$$ reliability in heterozygous women (with $$Hh$$ genotype), that is, it successfully detects the presence of the allele $$h$$ in $$85\%$$ of the cases, while in homozygous women (with $$HH$$ genotype) it fails to detect $$h$$ in $$1\%$$ of the cases. We want to calculate the following probabilities: $$P (\text{Britney}\,Hh | \text{test was positive})$$ and $$P(\text{Britney}\,HH | \text{test was negative})$$

I am not sure for the correct interpretation of the question, as I had to translate some terms I am not familiar with. With the little knowledge I have on statistics, I will make an attempt:

Prior probability Britney is homozygous or heterozygous $$P(ΗΗ)= P(Hh) = 0.5$$

$$P(E|Hh)= \text{Probability of a Positive Test Result given Britney is Heterozygous} = 0.85\\ \text{So, we have}\\ P(E|HH)= \text{Probability of a Positive Test Result given Britney is Homozygous} = 0.15$$

We want $$P(HH|E) = \text{Probability of Britney being Heterozygous given the test yields a Positive Result}$$

We also want $$P(Hh|E^c) = \text{Probability of Britney being Homozygous given the test yields a Negative Result}$$

So for a)

$$P(HH|E) = {P(E|HH) P(HH) \over P(E)} = {P(E|HH) P(HH) \over P(E|HH)P(HH) + P(E|{Hh}) P({Hh})}$$ and similarly for the second. Are these correct?

EDIT: Can you tell me if this is correct?

"$$P(E|HH)= \text{Probability of a Positive Test Result given Britney is Homozygous} = 0.15$$"

or is it "$$P(E|HH)= \text{Probability of a Negative Test Result given Britney is Heterozygous} = 0.15$$"?

• Please use proper TeX formatting when including texts within an equation from next time. Jun 1, 2022 at 12:16
• $P(Hh \mid E)$ is not the probability of Britney being Homozygous given the test yields a Negative Result but given the test yields a Positive Result. You want $P(Hh \mid E^c)$ Jun 1, 2022 at 13:08
• Guys, any full solution? This one I don't understand! Jun 1, 2022 at 14:32
• You may still have mixed homozygous / heterozygous. I would have thought you wanted $P(Hh\mid E) = {P(E\mid Hh) P(Hh) \over P(E)} = {P(E\mid Hh) P(Hh) \over P(E\mid HH)P(HH) + P(E\mid {Hh}) P({Hh})}$ and $P(HH\mid E^c) = {P(E^c\mid HH) P(HH) \over P(E^c)} = {P(E^c\mid Hh) P(Hh) \over P(E^c\mid HH)P(HH) + P(E^c\mid {Hh}) P({Hh})}$ Jun 1, 2022 at 16:30
• Related, perhaps helpful: math.stackexchange.com/questions/2279851/… Jun 2, 2022 at 14:10

By the law of total probability, $$P(Positive)=P(Positive|HH)P(HH)+P(Positive|Hh)P(Hh)=0.5\cdot0.99+0.5\cdot0.85=0.5(0.99+0.85)=0.5\cdot1.84=0.92$$ and so P(Negative)=0.08 (can also be calculated from the law of total probability).
(a)By Bayes Theorem, $$P(Hh|Positive)=\frac{P(Hh\cap Positive)}{P(Positive)}$$ $$=\frac{0.85\cdot 0.5}{0.92}=\frac{85}{184}≈0.4619=46.19\%$$
Similarly, (b) By Bayes Theorem, $$P(HH|Negative)=\frac{P(HH\cap Negative)}{P(Negative)}$$ $$=\frac{0.01\cdot 0.5}{0.08}=\frac{1}{16}=0.0625=6.25\%$$

• This one seems more reasonable. Jun 4, 2022 at 7:09
• Okay I guess I confused the last statement. I’ll update my answer. Jun 4, 2022 at 9:50
• By the way @OP could you just recheck your data once more? Nothing much, hypothetically no problem, but “in homozygous women (with 𝐻𝐻 genotype) it fails to detect h in 1% of the cases” I mean, if I am HH, it will detect h in 99% of the cases? A bit unrealistic, no? Jun 4, 2022 at 10:04
• That’s exactly what seemed confusing to me :p Jun 4, 2022 at 10:06
• @insipidintegrator this refers to the test reliability. That is, if I DO have the allele h and I have HH genotype, the test will fail to detect it (although it exists) in 1% of the cases. Jun 4, 2022 at 17:58

As I understand from your setting, you could approach the problem as follows:

Suppose you let $$T$$ be the event "the test is positive" (so the test detects the allele $$h$$), $$HH$$ the event "homozygous genotype", and $$Hh$$ the event "heterozygous genotype". We wish to compute the probabilities $$Pr(Hh|T)$$ and $$Pr(HH|T^c)$$.

We know the following:

• $$Pr(HH)=Pr(Hh)=1/2$$, so the probability of having either genome is the same.
• $$Pr(T|Hh)=0.85$$ from which you can deduce that $$Pr(T^c|Hh)=0.15$$.
• $$Pr(T^c|HH)=0.01$$ from which you can deduce that $$Pr(T|HH)=0.99$$.

From there, using Bayes' theorem, the law of total probability and remembering that the probability of having either genome is equal, we can directly compute \begin{align} Pr(Hh|T)=\frac{Pr(T|Hh)Pr(Hh)}{Pr(T)} &=\frac{Pr(T|Hh)Pr(Hh)}{Pr(T|Hh)Pr(Hh)+Pr(T|HH)Pr(HH)}\\ &=\frac{0.85\cdot 1/2}{(0.85+0.99)/2}\approx 46.2\%, \end{align} and \begin{align} Pr(HH|T^c)=\frac{Pr(T^c|HH)Pr(HH)}{Pr(T^c)}&=\frac{Pr(T^c|HH)Pr(HH)}{Pr(T^c|HH)Pr(HH)+Pr(T^c|Hh)Pr(Hh)}\\ &=\frac{0.01\cdot 1/2}{(0.01+0.15)/2}=6.25\%. \end{align}

Edit: I've confused the original statement and so had wrong calculations. The procedure however stays the same.

• I don't think this is the correct interpretation of "The test has $85\%$ reliability in heterozygous women. I'd rather assume it means that in $15\%$ of the cases it fails to detect the allele h, while it exists. Jun 3, 2022 at 16:46
• @NhungHuyen I've updated my answer with the correct calculations. The statement seemed confusing at start so I mixed up two probabilities. The answer should be good now :) Jun 4, 2022 at 9:59