# Bayes's Theorem with specificity = 1

Given Bayes's Theorem:

$$\text{P}(A|B)=\frac{\text{P}(B|A)\text{P}(A)}{\text{P}(B|A)\text{P}(A)+\text{P}(B|\neg A)\text{P}(\neg A)}$$

and a specificity of 1:

$$\text{P}(\neg B|\neg A)=1$$

Then:

$$\text{P}(B|\neg A)=0$$

And when you plug it into the Bayes's equation above you will always get:

$$\text{P}(A|B)=1$$

Which seems nonsense.

To provide a concrete example, if a test is 100% effective at not falsely diagnose a disease in those who are free from it, does this mean everyone has the disease?

What am I missing?

Answer: I was missing the fact that everyone who has tested positive has the disease (not everyone).

• You seem to be interpreting "$P(A|B)$" as an unconditional probability rather than as a conditional probability.
– whuber
Commented Jun 13, 2016 at 13:57
• @whuber Thanks for the reply, but I'm not sure what this means. Could you elaborate? Commented Jun 13, 2016 at 13:58
• If there is no way the test says you have the disease if you do not have it, then what does that imply for you having the disease if the test says you have it? Commented Jun 13, 2016 at 14:01
• @whuber, I can see my mistake now, with help from Alex's answer. I was interpreting the conclusion as 'A must occur', where in fact it reads 'A must occur given B', which is a reasonable conclusion. Commented Jun 13, 2016 at 15:57

The difference between joint probabilities and conditional probabilities is essential to understand and apply Bayes' theorem correctly. I strongly advise you go to the basics and refresh that.

$P(A,B)$ is the probability that both $A$ and $B$ occur at the same time. Then $P(A|B)$ is defined as the probability that $A$ occurs given the fact that $B$ occured.

Understanding what that means should allow you to understand that $P(A,B)=P(A|B)P(B)$ and at the same time $P(A,B)=P(B|A)P(A)$. Combining these two expressions gives $P(A|B)$ in terms of $P(B|A)$, [together with marginals $P(A)=P(A,B)+P(A,\neg B)$] is the content of Bayes' theorem.

In your case $P(\neg B|\neg A)=1$ tells you that if $A$ doesn't occur, then for sure $B$ will not occur. Therefore if $B$ occurred, then necessarily, $A$ must occur: $P(A|B)=1$.

This is called modus tollens in propositional logic $(P\Rightarrow Q) \Longleftrightarrow (\neg Q\Rightarrow\neg P)$

Example: Let $A=$ "you have the disease", and $B=$ "test gives positive". Then if $P(\neg B|\neg A)=1$ means the test never gives false positives, so if you get a positive (B occurs), you have the disease (A), $$P(A|B)=1.$$

First, you must notice that a probability is not about physical impossibility or physical certainty of an event $E$, but instead it is about the expectation you can logically build about that event.

In more mathematical terms, the physical impossibility of occurrence of an event $E$ is expressed as $E = \emptyset$ and physical certainty as $E = \Omega$.

It is important to highlight that $$P(E) = 0 \not\Rightarrow E = \emptyset$$ as well as $$P(E) = 0 \not\Rightarrow E = \Omega,$$ since, with another probability measure $P_2$, you can have $P_2(E)\in(0,1)$.

So, given $P(A), P(B) \in (0,1)$, then once you have $$P(B^c\mid A^c)=1,$$ then you will also have $$P(B^c\mid A^c) = \frac{P(B^c\cap A^c)}{P(A^c)} \Rightarrow P(A^c) = P(A^c\cap B^c),$$ but $$P(A^c) = P(A^c\cap B^c) + P( A^c \cap B)$$ therefore $$P(A^c \cap B) = 0,$$ which implies $$P(A^c \mid B) = \frac{P(A^c \cap B)}{P(B)} = 0,$$ which means, in terms of the context you proposed, that you expect never seeing someone without the disease among those tested positive.

Therefore it is only logical for you to expect always seeing people with disease among those who tested positive, or, mathematically, $$P(A \mid B) = 1.$$