| Title: | Functionality for handling the birthday problem with unequal probabilities |
|---|---|
| Description: | The package contains a simple function for computing the probability that in a group of n people, with ppl originating from one of N classes, that two or more people in the group are of the same class. |
| Authors: | Michael Höhle [aut, cre] |
| Maintainer: | Michael Höhle <[email protected]> |
| License: | GPL-3 |
| Version: | 0.0.0.9000 |
| Built: | 2026-06-10 07:19:29 UTC |
| Source: | https://github.com/mhoehle/birthdayproblem |
pbirthday, which handles unequal occurrence probabilitesThis function calculates the probability for at least one collision in a set of n individuals sampled iid. from a vector of length N with occurrence probabilities as given by the vector p. This is an instance of the birthday problem with unequal occurrence probabilities.
pbirthday_up(n, prob, method = c("R", "Rcpp", "mase1992"))pbirthday_up(n, prob, method = c("R", "Rcpp", "mase1992"))
n |
Size of the set |
prob |
Vector containing the occurrence probabilities. The length of |
method |
A string describing which computational method to use. |
A list containing the following elements:
prob(numeric) The probability for at least one collision
tListA matrix containing all compositions of singletons, dubletons, each row has the property sum(row * 1:n) == n.
Mase, S. 1992. “Approximations to the Birthday Problem with Unequal Occurrence Probabilities and Their Application to the Surname Problem in Japan.” Ann. Inst. Stat. Math. 44 (3): 479–99. http://www.ism.ac.jp/editsec/aism/pdf/044_3_0479.pdf.
Höhle, M., Happy pbirthday class of 2016, http://staff.math.su.se/hoehle/blog/2017/02/13/bday.html.
Höhle, M., US Babyname Collisions 1880-2014, http://staff.math.su.se/hoehle/blog/2017/03/01/morebabynames.html.
pbirthday(n=26, classes=365, coincident=2) pbirthday_up(n=26L, prob=rep(1/365,365), method="R")$prob pbirthday_up(n=26L, prob=rep(1/365,365), method="Rcpp")$probpbirthday(n=26, classes=365, coincident=2) pbirthday_up(n=26L, prob=rep(1/365,365), method="R")$prob pbirthday_up(n=26L, prob=rep(1/365,365), method="Rcpp")$prob