Test results are positive. What are the odds you have the virus? Surprise, intuition is wrong!

Bayes’s Theorem

P(A|B) = P(A) * P(B|A) / P(B)

probability table

P(A|B) = P(A) * P(B|A) / P(B) = 0.01 * 0.99 / 0.0198 = 0.5

chances vs infection rate

How about real-world testing?

  • the overall infection rate is very low (1%), and
  • you’re picking test subjects completely at random (picking completely random people out of the general population, like literally pulling first name / last name out of a hat)

How about negative test results?

Credits and code

sick.chance <- function(inf.rate, test.rel = 0.99, tot.pop = 10000) {
sick.pop <- tot.pop * inf.rate
healthy.pop <- tot.pop - sick.pop
pos.sick <- sick.pop * test.rel
neg.healthy <- healthy.pop * test.rel
pos.healthy <- healthy.pop - neg.healthy
pos.total <- pos.sick + pos.healthy
chance <- pos.sick / pos.total
return(chance)
}
infection.rate <- 1:100 / 100
chances <- lapply(infection.rate, sick.chance)
plot(infection.rate, chances, col = 'blue'); grid()

--

--

--

Graduated Physics. Engineer in the computer industry. Working on my Master’s degree in Data Science.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Solving the Mystery of STP Conditions?

The Rule of 72 — a Shortcut That Makes Anyone Look Like a Math Genius

Bayes’ Theorem and Diagnostic Testing

The Pigeonhole Principle

Probability — Basic Concepts

Why the rich will always become richer (unless they really screw it up)!

Tensor Products — Linear Algebra for QC

READ/DOWNLOAD*^ First Step To Mathematical Olympiad Problems, A FULL BOOK PDF & FULL AUDIOBOOKEPUB…

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Florin Andrei

Florin Andrei

Graduated Physics. Engineer in the computer industry. Working on my Master’s degree in Data Science.

More from Medium

Multi-objective optimization under uncertainty

Classification Models for Subreddits: Wedding Planning vs Divorce

How Confident Are You the Sun Will Rise Again ?

Understanding data science from a military point of view