Created 20/07/2020 at 06:07PM

In this section we will talk about priors, what we believe prior to seeing the data. Sometimes Priors are very rigours, and based on previous research, and sometimes they are more diffuse.

As in the previous post:

$$ \begin{aligned} \theta &= \text{ What we care about} \rightarrow\text{ COVID19} \newline y &= \text{ What we measure (the data)} \rightarrow\text{ Test Result} \end{aligned} $$

The symbol "$\neg$" means not, thus $\theta$ means has had COVID19, $\neg\theta$ means has not had COVID19, and $Pr(\theta)$ means the probability of COVID19, since $Pr(\theta)$ does not contain $y$, we call it the prior, as it is the prior probability of $\theta$ before we see the data.

In March COVID19 tests were conserved for health care providers. My wife's coworker came down sick after coming home from a COVID19 hot zone, and subsequently other colleges got sick, along with my entire family. While we were recovering a partner of another coworker got sick and tested positive. So we were part of a chain were many people got sick, but only one person a few step removed from us were ever tested (and was positive).

What is the probability that my wife had COVID19?, my wife had all the symptoms of a moderate case of COVID19. Because of the positive test, the symptoms, and the contagion of the disease, I estimated that there were 85% chance that we had COVID19.

While 85% is somewhat arbitrary, it was the best inference I personally could make based on the then available "data", and in any case, it is better than picking 3% (the number of people in Denmark with antibodies).

In the previous post we learned that

$$ Pr(y\mid{}\theta) = \frac{Pr(\theta,y)}{Pr(\theta)} $$

Thus, by reorganizing

$$ Pr(\theta,y) = Pr(y\mid{}\theta)Pr(\theta) $$

And, the same holds if we flip the variables

$$ Pr(\theta,y) = Pr(\theta\mid{}y)Pr(y) $$

Obviously $Pr(\theta,y)=Pr(\theta,y)$ So

$$ Pr(\theta\mid{}y)Pr(y) = Pr(y\mid{}\theta)Pr(\theta) $$

And by dividing $Pr(y)$ away, we have Bayes Theorem.

$$ Pr(\theta\mid{}y)= \frac{Pr(y\mid{}\theta)Pr(\theta)}{Pr(y)} $$

In common parlance, the 4 parts of Bayes Theorem are called:

$$ posterior = \frac{likleyhood\times{}prior}{data} $$

The Sensitivity ($Pr(y\mid{}\theta)$) and Specificity ($Pr(\neg{}y\mid{}\neg\theta)$) are likelihoods which tells us how likely it is to observe the two datums $y$ and $\neg{}y$. The posterior is the probability of having had COVID19 given a test result, now all we need it the innocent little $y$. How do we calculate that?

How was the data generated?, Here the example is one positive test. Because our variable is dichotomous, there are two ways to generate that data:

$$ Pr(y) = Pr(y,\theta) + Pr(y,\neg\theta) $$

Either you have a positive test and have COVID19, or you have a positive test and you do not have COVID19. We do not have these joined probabilities at hand, but we know to convert between joined and conditional probabilities:

$$ Pr(y) = Pr(y\mid{}\theta)Pr(\theta) + Pr(y\mid{}\neg\theta)Pr(\neg\theta) $$

The above is very close to what we have, but we do not have $Pr(\neg\theta)$ and we do not have $Pr(y\mid{}\neg\theta)$, we do however know that probabilities have to sum to 1, thus we know that:

$$ Pr(\theta) + Pr(\neg\theta) = 1 $$

$$ Pr(y\mid{}\neg\theta) + Pr(\neg{}y\mid{}\neg\theta) = 1 $$

Knowing this we can reformulate the data generation process in terms of the 3 variables we have:

$$ Pr(y) = Pr(y\mid{}\theta)Pr(\theta) + (1 - Pr(\neg{}y\mid{}\neg\theta))(1 - Pr(\theta)) $$

What we have is a prior ($Pr(\theta)$) and, two likelihoods: $Pr(y\mid{}\theta)$ and, $Pr(\neg{}y\mid{}\neg\theta)$.

So my wife took an antibody test, and it was negative. Thus we have to reformulate Bayes Theorem and the generative process in terms of $Pr(\neg{}y)$

First we describe how the data could be generated, the data here being the Negative test ($\neg{}y$):

$$ \begin{aligned} Pr(\neg{}y) &= Pr(\neg{}y,\neg\theta) &+& Pr(\neg{}y,\theta) \newline &= Pr(\neg{}y\mid{}\neg\theta){}Pr(\neg\theta) &+& Pr(\neg{}y\mid{}\theta)Pr(\theta) \newline &= Pr(\neg{}y\mid{}\neg\theta)(1 - Pr(\theta)) &+& (1 - Pr(y\mid{}\theta))Pr(\theta) \end{aligned} $$

Then the posterior (the probability of having COVID19 given a negative test) is:

$$ \begin{aligned} Pr(\neg\theta\mid{}\neg{}y) &= \frac{Pr(\neg{}y\mid{}\neg\theta)(1 - Pr(\theta))}{Pr(^\neg{}y)} \newline Pr(\theta\mid{}\neg{}y) &= 1 - \frac{Pr(\neg{}y\mid{}\neg\theta)(1 - Pr(\theta))}{Pr(^\neg{}y)} \end{aligned} $$

Let's plug in the numbers for $Pr(\neg{}y)$

$$ \begin{aligned} Pr(\neg{}y) &= Pr(\neg{}y\mid{}\neg\theta)(1 - Pr(\theta)) + (1 - Pr(y\mid{}\theta))Pr(\theta) \newline &= \frac{123}{124}(1 - 0.85) + (1 - \frac{27}{28})\times{}0.85 \newline &\approx 0.0149 + 0.030 \approx 0.179 \end{aligned} $$

And then for the posterior:

$$ Pr(\theta\mid{}\neg{}y) = 1 - \frac{Pr(\neg{}y\mid{}\neg\theta)(1 - Pr(\theta))}{Pr(\neg{}y)} = 1 - \frac{\frac{123}{124}(1 - 0.85)}{0.179} \approx 0.170 $$

So there is a 17% chance that my wife has had COVID19.

Is this the best inference we could do with the available
data?. Can we now proclaim ourselves enlightened Bayesian. **NO!**, what we
have done is calculating a point estimates... True Bayesians think in
distributions, There is some uncertainly associated with the Data used to
calculate specificity and sensitivity, and there are also some uncertainly
around my point estimate of $Pr(\theta)=0.85$. This is what the next few blog
posts will be about.

The uncertainly associated with the test data is relatively easy to take into account, and is at the heart of Bayesian modeling, and will be the topic of the next post.

This is part 2 of 2 in the "Good Bayesian" Series.

Clik here to go to the previous post