-
-
Save toyeiei/4d803ac9f170d5fea9499dc9bd3105b5 to your computer and use it in GitHub Desktop.
simple bayes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# get 15 head from 20 draws - fair coin | |
p_H15_fair <- dbinom(15, 20, prob = 0.50) | |
# get 15 head from 20 draws - biased coin | |
p_H15_biased <- dbinom(15, 20, prob = 0.75) | |
# subjective probability about the coin | |
p_fair <- 0.4 | |
p_biased <- 1 - p_fair | |
# bayes theorem | |
p_fair_H15 <- p_H15_fair * p_fair / (p_H15_fair * p_fair + p_H15_biased * p_biased) | |
print(p_fair_H15) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment