Skip to content

Instantly share code, notes, and snippets.

@toyeiei
Last active January 28, 2019 10:06
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
bayes example
# what we know
p_pos_cancer <- 0.99
p_cancer <- 0.01
p_not_cancer <- 1 - 0.01
p_pos_not_cancer <- 0.05
# bayes theorem
p_cancer_pos <- (p_pos_cancer*p_cancer) / (p_pos_cancer*p_cancer + p_pos_not_cancer*p_not_cancer)
print(p_cancer_pos) # 0.1667
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment