Have you ever wondered about the likelihood of sharing a birthday with someone in a room? Is it just a random coincidence or something more common than we think? To answer these questions, I've created an interactive tool that you can use to estimate the probability of people sharing the same birthday. In this blog post, I'll introduce you to this interesting concept and show you how to use my Shiny app (embedded below and can also be accessed online here) to visualize the computed probabilities .
The Birthday Paradox is a well-known problem in probability theory that often surprises people with its counterintuitive results. It goes like this:
In a room, there exists a group of individuals, denoted by n. We make the assumption that every person's birthday is equally likely to occur on any of the 365 days of the year, excluding February 29. Additionally, we consider the birthdays of people to be independent, implying that there are no twins present in the room.
Seems like you'd need a large group of people for this to happen; however, the reality is quite different.
\( Pr(n \geq 1) = 1 - Pr(n = 0) \) \( \text{ Where: } Pr(X = 0) = \frac{P_n^{365}}{365^n} \) \( Pr(n \geq 1) = \prod_{i=0}^n \left(1 - \frac{i}{365}\right) \)
Implementing the above routine predicts that there is almost always a 50% and 99.999% chance that atleast two people will share a birthday in a room with 23 and 68 people, respectively.
My Birthday Shiny app allows you to explore and visualize this concept in detail. To begin, you need to input the following parameters:
You can download, zoom, pan, autoscale, reset axes of your plot using plotly menu located above your plot. You can also view and compare points on your plot on hover. The default is view closest data on hover.