Skip to main content

What to make of a COVID test

Let's apply Bayes formula to this question:

Problem

Suppose you test +ve for COVID using a lateral flow test. How convinced should you be that you are infected?

Like many scientific problems, this one can be solved by applying Bayes' formula. Let's try now:

P(infected+ve test result)=P(+ve test resultinfected)prior(infected)denominatorP\left(\text{infected}|{\text{+ve test result}}\right) = \frac{P\left(\text{+ve test result}|\text{infected}\right) \cdot \text{prior}(\text{infected})}{\text{denominator}}

But how can we generate those numbers?

Luckily there are huge datasets in which to estimate the quantities! For example this review of COVID-19 lateral flow test accuracy.

It reports results as:

  • "Sensitivity" i.e. P(+ve test resultinfected)P(\text{+ve test result}|\text{infected}) as 72% for symptomatic and 58% for asymptomatic patients
  • "Specificity" i.e. P(-ve test resultnot infected)P(\text{-ve test result}|\text{not infected}) as between 99.6% and 99.9%.
Note

There are also other estimates, such as this study in Welsh care homes, or this study. They suggest higher specificity more like 99.9%. (Maybe you can find other estimates too?)

Population COVID rates aren't still being reported so let's use numbers from 2023.

For example for Oxfordshire, UK the numbers in September 2023 were around a maximum of:

  • 21.8 cases per 100,000 people in under-59s
  • or 57.5 cases per 100,000 in the over-60s

Given the lack of systematic testing at the time, you could reasonably assume these must be underestimated. To be conservative, you might want to err on the side of caution - so let's imagine the true rate to be substantially larger than this - say at least 100 in 100,000.

Can you use Bayes' theorem to answer the question?

Note

Remember we can compute the denominator by summing over the possibilities in the numerator. Here the possibilities are 'is infected' or 'isn't infected'. So the denominator is:

denominator=P(+veinfected)P(infected)+P(+venot infected)P(not infected)\text{denominator} = P\left( \text{+ve}|\text{infected}\right) \cdot P\left(\text{infected} \right) + P\left( \text{+ve}|\text{not infected}\right)\cdot P\left(\text{not infected} \right)