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

Island Perimeter 🚂

New Math

Factors of 146 | Factors of 146 in Pairs

Factors of 146

Why Things Almost Always Take Longer than Planned

What does the coastline of Great Britain have to do with project delays?

Distributed or Curated: What’s the Difference?

美国物理量子力学代考-物理代写-physics代写-电动力学代考

量子力学代考-代写之家

Unreasonable Effectiveness of Mathematics

Too Random, Or Not Random Enough: Student Misunderstandings About Probability In Coin Flipping

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

Sometimes, You Have To Admit It’s Rare

The Danger Of Uncontextualized Stats

Calculate a stock’s beta in R