# Application: differential diagnosis¶

The purpose of this series of notebooks on Bayesian logic in clinical diagnostics is to give a mathematically robust and intelligible summary to help physicians, epidemiologists, nurses, NPs and in the field, as well as their consumers, understand clinical decisionmaking as an objective process amenable to analysis and quantification rather than using 'instinct' or 'experience' as a surrogate explanation for a process that can – and should – be made explicable, interpretable and if need be, interrogable. This does not mean to simplify diagnostics (the practice) or imply that it's in any way an automatic processhat can be reduced to a simple algorithm. But diagnosis (the logical process) is, and should be. The purpose of these notebooks is to help with that process.

About the author: I'm Chris von Csefalvay, a clinical computational epidemiologist and expert in filoviridae working for CBRD. You can find me on Twitter, Facebook and, of course, Github. Please feel free to let me know if you have any questions, corrections or suggestions.

Differential diagnosis describes the process of finding a list of potential diagnostic solutions for a particular set of symptoms, then determining the solution with the greatest probability given the symptoms. Or, formally defined: given a patient exhibiting the symptoms $\mathcal{S} = S_{1 \ldots m}$ and potential diagnostic solutions $\mathcal{Dx}$, which solution $Dx_{\sigma} \in \mathcal{Dx}$ maximises $f(x \in \mathcal{Dx}) = p(x \mid \mathcal{S})$? In other words, the objective is to find

$$\underset{x \in \mathcal{Dx}} {\operatorname{arg\,max}} \ \ f(x) = \underset{x \in \mathcal{Dx}} {\operatorname{arg\,max}} \ \ p(x \mid \bigcap_{i = 1}^{m} S_i)$$

Here, the $\bigcap_{i=1}^{m} S_i$ operator describes the intersection of symptoms $S_{1 \ldots m}$, i.e.  $S_1 \cap \ldots \cap S_m$. In practice, the inverse probability (the probability of a symptom occurring given a diagnosis, i.e. $p(S_q \mid D_r) \mid S_q \in \mathcal{S}, D_r \in \mathcal{D}$, is typically more available. For this reason, we will need to rely on Bayesian logic to reverse patterns of causality.

We will consider two specific situations of two patients, denoted as Alice and Bob, presenting with identical symptoms $S$. Their differential diagnosis $\mathcal{Dx}_{Alice}$ and $\mathcal{Dx}_{Bob}$ includes, among others, a vaccine-preventable disease $D_{VPD}$, against which Alice is vaccinated, but Bob is not. The vaccine has a failure rate of 2%. Amongst the unvaccinated, $D_{VPD}$ is present in about 0.1% of all who turn up at this particular hospital. For simplicity's sake, we are treating the conjunction of symptoms as a binary event and consider all of them indispensable for a diagnosis of $D_{VPD}$, so that patients either exhibit ($S^+$) or do not exhibit ($S^-$) the totality of the symptoms defined to be pathognomonic of the disease. We know that overall 8.0% of the population reporting for treatment at this facility exhibit all of the pathognomonic symptoms (with or without others), as these symptoms are fairly nonspecific. We further know 'by definition' that everyone who does have $D_{VPD}$ is $S^+$, i.e. exhibits all symptoms.

## Bob's case¶

Bob's case is somewhat simpler, so let's start with that. What's the probability for Bob, who exhibits the symptom combination $S$ (i.e. $S^+$), to have $D_{VPD}$, against which he is not vaccinated? In other words, what is the probability $p(D_{VPD} \mid S^+)$ in an unvaccinated individual?

Bayes' theorem states that

$$p(D_{VPD} \mid S^+)_{unvax} = \frac{p(S^+ \mid D_{VPD}) p(D_{VPD})}{p(S^+)}$$

where $p(D_{VPD})$ denotes the probability that an unvaccinated person presenting at this particular hospital has $D_{VPD}$ and $p(S^+)$ denotes the probability that a person presenting at this hospital will exhibit the symptoms $S$ pathognomonic for $D_{VPD}$.

We know $p(D_{VPD})$ is 0.1% or $0.001$ and $p(S^+)$ is 8% or $0.08$. Finally, since the symptoms $S$ are deemed to be conclusively pathognomonic of $D_{VPD}$, i.e. they occur in every case without exception, we can eliminate $p(S^+ \mid D_{VPD})$ as its value is 1. This leaves a probability

$$p(D_{VPD} \mid S^+)_{unvax} \ = \frac{p(D_{VPD})}{p(S^+)} \ = \frac{0.001}{0.08} = 0.0125 \ \ \ \ (1.25 \times 10^{-2})$$

In other words, a probability of $1.25\%$.

## Alice's case¶

In Alice's case, we know she is vaccinated but we do not know if she is immune. Therefore, we compensate for this by calculating $p(D_{VPD})_{vax}$ to account for the risk of her being susceptible despite vaccination – in other words, we take the baseline risk $p(D_{VPD})_{naive}$, which is $0.1\%$, and multiply it by the risk of vaccine failure, $1 - E_{vax}$, i.e. $2\%$, since by definition $p(D_{VPD})_{immune} = 0$.

$$p(D_{VPD})_{vaxed} \ = (1 - E_{vax}) \cdot p(D_{VPD} \mid naive) \ = 0.02 \cdot 0.001 = 0.00002$$

Since the other terms, $p(S^+)$ and $p(S^+ \mid D_{VPD})$, were calculated by reference to the whole population, they do not necessarily have to be adjusted, although this introduces a small margin of error: the unvaccinated do tend to present with more specific symptoms $S^+$ more often than the vaccinated. However, unless exact data to this effect are available, it is best not to compensate for that effect unless symptoms are extremely specific – which, for most VPDs, they are not.

Presenting with the symptoms $S$, her probability of $p(D_{VPD} \mid S^+)_{vaxed}$ is given by Bayes' theorem as

$$p(D_{VPD} \mid S^+)_{vaxed} \ = \frac{p(S^+ \mid D_{VPD})p(D_{VPD})_{vaxed}}{p(S^+)} \ = \frac{p(D_{VPD})_{vaxed}}{p(S^+)} = \frac{0.00002}{0.08} \ = 0.0000016 \ \ \ \ \ (1.6 \times 10^{-6})$$

In other words, the likelihood of Bob having $D_{VPD}$ is 7,800 times as high as that of Alice.

## Why is this relevant?¶

It is a frequently raised accusation of anti-vaccine activists that doctors routinely rule out diseases against which a person is vaccinated. This is quite simply not true. Rather, the probability of an unvaccinated person having the disease is four orders of magnitude higher in this quite typical case. A difference that significant is likely to alter the order of differential diagnosis priorities, putting other causes ahead of $D_{VPD}$. This is not because doctors 'refuse' to diagnose diseases one is vaccinated against, but for the simple reason that such a person has a much lower risk of having $D_{VPD}$ than an unvaccinated but identically symptomatic counterpart.

Another accusation so levelled is that because of this, either occurrence statistics are unreliable because they would be misdiagnosed as other illnesses due to the refusal of diagnosing a vaccinated-against condition, or vaccine efficacy numbers are incorrect, because the knowledge of vaccination affects the diagnostic process. This is false. To illustrate this point, it is important to look at what factored into our calculation of $p(D_{VPD} \mid S^+)$:

• $p(S^+ \mid D_{VPD})$: this figure derives from an analysis of confirmed (almost always serologically confirmed, e.g. RT-PCR) cases and reported symptoms/CCs at admission. Note that for this, it's irrelevant if the patient was vaccinated or not, because it presupposes that the patient has $D_{VPD}$, i.e. either their vaccine failed or they were immunonaive.
• $p(D_{VPD})$: it is true that we changed this variable to factor in vaccination and vaccine efficacy. We did so by reference to $E_{vax}$, which is externally defined in controlled trials. Thus, once again it doesn't matter if patient were or weren't vaccinated, because the relevant values for $E_{vax}$, and the consequent value $p(D_{VPD})$,                               and therefore unaffected by diagnostic practices.
• $p(S^+)$: The frequency of the particular symptom ensemble also has nothing to do with the vaccine. Sure, people who vaccinate are statistically less likely to present with measles like rashes. But that is irrelevant because $p(S^+)$ is the probability of a rash on a person who comes through the door, regardless of vaccine status.

In other words, the above can be, and was, deduced without tautology, and is not circular. You can trace the steps yourself. It disproves the anti-vaccination trope that either

• vaccine effectiveness rates ($E_v$) are affected by the practice of 'ignoring' conditions the patient is vaccinated against and therefore unreliable; or that
• occurrence statistics ($p(D_{VPD})$) are affected by the practice of 'ignoring' conditions the patient is vaccinated against and therefore unreliable.

Note that no such 'practice' actually exists, but is rather a misunderstanding of the fact that vaccination does, undeniably, makes disease less likely, and therefore the probability of $D_{VPD}$ is lower in such patients, all things being equal, as the case of Alice vs Bob shows.

# TL;DR¶

• Doctors don't ignore diseases a patient is vaccinated against as part of the differential diagnosis process. This is either a misunderstanding or a lie.
• Rather, the probability of such diseases is smaller because vaccines work. We know this independently from the rates of diagnosis in the clinic: we know this from separate studies controlled, usually, by serology or RT-PCR.
• Every time an anti-vaccination meme dies, an angel gets his wings and a kitten gets a cookie.