# How accurate is the Covid swab test?

I am not a medical expert but approach this from a **statistical** point of view.

I was wondering what a positive test result would tell you about the probability that you actually have the disease. I think for the UK swab test we have a true positive rate of 0.99 and the true negative rate is 0.80. I think this is because you administer it yourself and it can be unreliable.

In order to derive the probability you have the disease given a positive test P(D|T) we need a prior for P(D) and then apply Bayes theorem. If we assume P(D) is 1% then we get a 4.77% chance of having the disease (given the test). Now this is actually quite low. Maybe the people that go to the test centre have symptoms and their prior is actually higher — say 10%. This implies that your posterior is 35.5%.

What is the probability you don’t have the disease given a negative test. Again using Bayes theorem, we get 99.99% chance of not having the disease. So pretty certain.

What if you have two tests? This is an interesting one, you can actually use the posterior from test 1 as the prior for test 2. This is called **Bayesian updating.** With an initial prior of 1% we get a 19.8% chance of having the disease having two positive tests.

The code for this can be found in this colab.