We have simulated the birthday problem, assuming that births are equally likely to occur throughout the year. However, we saw from the UK example that the actual births do not always follow this assumption and can vary.
So, we want to know the impact of this deviation on the number of people sharing a common birthday. We repeat the simulation but incorporate the actual probability. Here is a comparison for a group of 23. In the first case, we used the actual probability (average daily births), and in the second case, we used the assumption of equally likely.
birth_day <- function(people, iterations, probs){
birth <- replicate(iterations, {
days <- sample(1:366, people, replace = TRUE, prob = probs)
duplicated(days) %>% max()
})
mean(birth)
}
birth_day(23, 10000, B_data$average)
birth_day(23, 10000, rep(1/366, 366))
0.5079
0.5026
Like before, we can scan the whole spectrum of groups and compare the theory with the actual. Unfilled circles represent the theory, and the red line represents the actual.
Reference
How popular is your birthday?: ONS