Created
May 27, 2020 20:19
-
-
Save arvi1000/3bb7df8456cbb1886cfb81118943905a to your computer and use it in GitHub Desktop.
This file contains hidden or 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(tidyverse) | |
streak_len <- 7 | |
ref_denom <- 276 | |
tibble(x=1:streak_len, | |
y=(1/6)^x) %>% | |
ggplot(aes(x=x+1, y=y)) + | |
geom_point() + | |
geom_line() + | |
geom_hline(yintercept = 1/ref_denom, linetype='dotted', color='red') + | |
annotate('text', | |
x=(streak_len+1), y=1/ref_denom, | |
label=paste0('(1/', ref_denom, ', chance)'), | |
color='red', size=3, vjust=-1, hjust=1) + | |
scale_x_continuous(breaks=1:(streak_len+1), minor_breaks = NULL) + | |
scale_y_log10(labels=scales::percent) + | |
labs(title='Chance of X consecutive identical rools of a 6-sided die', | |
x='Same-roll streak', y='Probability') + | |
theme_light() | |
Author
arvi1000
commented
May 27, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment