Created
June 2, 2019 14:35
-
-
Save statwonk/ececfe9263cf126d7281872ed81ba040 to your computer and use it in GitHub Desktop.
A visualization of the beta 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(tidyverse) | |
plot.new() | |
par(bg = "black") | |
plot(density(rbeta(1e6, 50, 50)), col = "pink3", lwd = 1, ylim = c(0, 8), | |
xlab = "", ylab = "", main = "Beta distribution", axes = FALSE, | |
col.main = 'white') | |
map2(c(seq(1, 49, 1), 50), | |
c(seq(1, 49, 1), 50), | |
function(x, y){ message(x,y);rbeta(1e6, x + 1, y + 1)}) %>% | |
map(function(x) { density(x) %>% | |
lines(col = sample(colors(), 1), | |
lwd = 1, | |
lty = sample(1:10, 1))}) %>% | |
invisible() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment