blog/what-is-the-probability-that-two-persons-have-the-same-initials/ #110
Replies: 1 comment 5 replies
-
There are fewer combinations of two LETTERS taken two at a time (325) than there are days in a non-leap year (365). Therefore, we expect that the probability of two persons sharing a pair of initials (assuming that all pairs are equally probable, which isn't the case in practice because very few people are named Xerxes Xanadu compared to people named Meagan Kelly) is greater than two persons sharing the same birthday. Indeed, on day 23, when two birthdays are likely to be shared equals 0.507, the probability of shared initials is 0.549. A solution to the birthday problem can be extended to the initials problem. have_same <- function(s,n) {
sample_space = s
probability = 1
for (i in 0:(n - 1)) {
probability = probability * (sample_space - i) / sample_space
}
1 - probability
}
# Example: Calculate the probability for n = 23 people
# sharing a birthday
birthday <- 365
people <- 23
have_same(birthday,people)
#> [1] 0.5072972
results <- vector(length = birthday)
for(i in 1:birthday) results[i] = have_same(birthday,i)
plot(1:birthday,results,"l") # sample space--the possible combination of THREE-letter initials
initials <- dim(combn(LETTERS,3))[2]
have_same(initials,people)
#> [1] 0.09297894
results <- vector(length = initials)
for(i in 1:initials) results[i] = have_same(initials,i)
plot(1:initials,results,"l") Created on 2023-12-06 with reprex v2.0.2 |
Beta Was this translation helpful? Give feedback.
-
blog/what-is-the-probability-that-two-persons-have-the-same-initials/
Learn how to use simulations and for loops in R to answer a probability question such as What is the probability that two persons have the same initials?
https://statsandr.com/blog/what-is-the-probability-that-two-persons-have-the-same-initials/
Beta Was this translation helpful? Give feedback.
All reactions