Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A visualization of the beta distribution.
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
You can’t perform that action at this time.