R Markdown

These calculations illustrate the role of Covid prevalance in determining how useful population-wide testing is. The definition of conditional probability gives: \[ \text{Pr}(C+ \mid T+) = \frac{\text{Pr}(T+ \mid C+)\text{Pr}(C+)}{\text{Pr}(T+ \mid C+)\text{Pr}(C+) + \text{Pr}(T+ \mid C-)\text{Pr}(C-)} \]

C19plus <- function(tp,fp,prev){
tp*prev/(tp*prev + fp*(1-prev))
}

While we’re at it,

C19minus <- function(tn,fn,prev){
tn*(1-prev)/(tn*(1-prev) + fn*prev)}

Prevalence is hard to pin down, but the following shows the probabilty that one has covid, given a positive test, for a range of prevalence values.

options(scipen=100) # disables scientific notation for prevvals
prevvals <- c(.0001, .001, .005, .01, .05, .1)
ppv <- C19plus(.8,.01,prevvals)
mydf <- data.frame(cbind(ppv,prevvals))
mydf
##           ppv prevvals
## 1 0.007937295   0.0001
## 2 0.074142725   0.0010
## 3 0.286738351   0.0050
## 4 0.446927374   0.0100
## 5 0.808080808   0.0500
## 6 0.898876404   0.1000

The probability of having a disease, given a positive test, is called the positive predictive value of the test. It depends quite strongly on the prevalence of the disease. Estimates of Covid prevalence in the UK are hard to come by, but this web site estimates that during the most recent week (Aug 30 - Sep 5), the prevalence was estimated at around 1 in 1,400 people, i.e. 0.0007. The World Health Organization’s COVID-19 Dashboard reports 374,000 confirmed cases in the UK since the beginning of the epidemic; the population of the UK is 66.6 million, so this gives an estimated of 0.005 (of current or resolved covid, which is a bit different). There would have been many asymptomatic cases, so perhaps the prevalence is as large as 1 or 2%, but it seems unlikely at this time to be as large as 10%. A widely criticized study published early in the epidemic estimated population prevalence in a county in California at \(2.5 - 4\)%.

prevvals2 <- seq(.0007,.1,length=50)
ppv2 <- C19plus(0.8, 0.01, prevvals2)
plot(prevvals2,ppv2,xlab="prevalence", main = "Prob(CV |  positive test)", ylab = "PPV", type="l", yaxp=c(0,1,10), ylim=c(0,1))
points(x=c(0.0007, 0.005, 0.01, 0.02), y=c(.053,.287,.447,.620), ,pch="X",col="red")