# Birthday problem crossing(n = 2:100, x = 2:4) %>% mutate(probability = map2_dbl(n, x, ~pbirthday(.x, coincident = .y))) %>% ggplot(aes(n, probability, color = factor(x))) + geom_line() + labs(x = "People in room", y = "Probability X people share a birthday", color = "X") # Approximating birthday paradox with Poisson distribution crossing(n = 2:250, x = 2:4) %>% mutate(combinations = choose(n, x), probability_each = (1/365)^(x-1), poisson = 1-dpois(0, combinations * probability_each), pbirthday_x = map2_dbl(n, x, ~pbirthday(.
Last updated on
2020-08-07
2 min read
R