pbirthday_up: Variant of 'pbirthday', which handles unequal occurrence...

Description Usage Arguments Value References Examples

Description

This 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.

Usage

1
pbirthday_up(n, prob, method = c("R", "Rcpp", "mase1992"))

Arguments

n

Size of the set

prob

Vector containing the occurrence probabilities. The length of prob determines N.

method

A string describing which computational method to use. "R" (the default) works in acceptable time up to n's of about 30. The "Rcpp" options works for larger n of moderate size, e.g., n=60 takes about 3 minutes. For larger n or faster computation one can use the "mase1992" approximation, which is surprisingly accurate.

Value

A list containing the following elements:

prob

(numeric) The probability for at least one collision

tList

A matrix containing all compositions of singletons, dubletons, each row has the property sum(row * 1:n) == n.

...

References

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.

Examples

1
2
3
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")$prob

hoehleatsu/birthdayproblem documentation built on May 17, 2019, 4:36 p.m.