Created
April 26, 2017 16:45
-
-
Save rmcelreath/5e2a58a49b027e17640545675ee634c1 to your computer and use it in GitHub Desktop.
Example of using shade to paint tail on distribution
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
library(rethinking) | |
p_grid <- seq( from=0 , to=1 , length.out=100 ) | |
prior <- rep( 1 , 100 ) | |
likelihood <- dbinom( 6 , size=9 , prob=p_grid ) | |
posterior <- likelihood * prior | |
posterior <- posterior / sum(posterior) | |
plot( posterior ~ p_grid , type="l" ) | |
shade( posterior ~ p_grid , lim=c(0,0.5) , col=rangi2 ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment