please see the following Python-script for Python2.
Answer is inspired by David C's answer.
My final answer would be, the probability of finding at least five Jacobs in one class, with Jacob being the most probable name according to the data from https://www.ssa.gov/oact/babynames/limits.html "National Data" from 2006.
The probability is calculated according to a binomial distribution with Jacob-Probability being the probability of success.
import pandas as pd
from scipy.stats import binom
data = pd.read_csv(r"yob2006.txt", header=None, names=["Name", "Sex", "Count"])
# count of children in the dataset:
sumCount = data.Count.sum()
# do calculation for every name:
for i, row in data.iterrows():
# relative counts of each name being interpreted as probabily of occurrence
data.loc[i, "probability"] = data.loc[i, "Count"]/float(sumCount)
# Probabilites being five or more children with that name in a class of size n=25,50 or 100
data.loc[i, "atleast5_class25"] = 1 - binom.cdf(4,25,data.loc[i, "probability"])
data.loc[i, "atleast5_class50"] = 1 - binom.cdf(4,50,data.loc[i, "probability"])
data.loc[i, "atleast5_class100"] = 1 - binom.cdf(4,100,data.loc[i, "probability"])
maxP25 = data["atleast5_class25"].max()
maxP50 = data["atleast5_class50"].max()
maxP100 = data["atleast5_class100"].max()
print ("""Max. probability for at least five kids with same name out of 25: {:.2} for name {}"""
.format(maxP25, data.loc[data.atleast5_class25==maxP25,"Name"].values[0]))
print
print ("""Max. probability for at least five kids with same name out of 50: {:.2} for name {}, of course."""
.format(maxP50, data.loc[data.atleast5_class50==maxP50,"Name"].values[0]))
print
print ("""Max. probability for at least five kids with same name out of 100: {:.2} for name {}, of course."""
.format(maxP100, data.loc[data.atleast5_class100==maxP100,"Name"].values[0]))
Max. probability for at least five
kids with same name out of 25: 4.7e-07 for name Jacob
Max. probability for at least five
kids with same name out of 50: 1.6e-05 for name Jacob, of course.
Max. probability for at least five
kids with same name out of 100: 0.00045 for name Jacob, of course.
By a factor of 10 same result as David C's. Thanks.
(My answer does not sum all the names, should may be discussed)