birthday

0th

Percentile

Probability of coincidences

Computes answers to a generalised birthday paradox problem. pbirthday computes the probability of a coincidence and qbirthday computes the smallest number of observations needed to have at least a specified probability of coincidence.

Keywords
distribution
Usage
qbirthday(prob = 0.5, classes = 365, coincident = 2)
pbirthday(n, classes = 365, coincident = 2)
Arguments
classes

How many distinct categories the people could fall into

prob

The desired probability of coincidence

n

The number of people

coincident

The number of people to fall in the same category

Details

The birthday paradox is that a very small number of people, 23, suffices to have a 50--50 chance that two or more of them have the same birthday. This function generalises the calculation to probabilities other than 0.5, numbers of coincident events other than 2, and numbers of classes other than 365.

The formula used is approximate for coincident > 2. The approximation is very good for moderate values of prob but less good for very small probabilities.

Value

qbirthday

Minimum number of people needed for a probability of at least prob that k or more of them have the same one out of classes equiprobable labels.

pbirthday

Probability of the specified coincidence.

References

Diaconis, P. and Mosteller F. (1989) Methods for studying coincidences. J. American Statistical Association, 84, 853--861.

Aliases
  • qbirthday
  • pbirthday
Examples
library(stats) # NOT RUN { require(graphics) ## the standard version qbirthday() # 23 ## probability of > 2 people with the same birthday pbirthday(23, coincident = 3) ## examples from Diaconis & Mosteller p. 858. ## 'coincidence' is that husband, wife, daughter all born on the 16th qbirthday(classes = 30, coincident = 3) # approximately 18 qbirthday(coincident = 4) # exact value 187 qbirthday(coincident = 10) # exact value 1181 ## same 4-digit PIN number qbirthday(classes = 10^4) ## 0.9 probability of three or more coincident birthdays qbirthday(coincident = 3, prob = 0.9) ## Chance of 4 or more coincident birthdays in 150 people pbirthday(150, coincident = 4) ## 100 or more coincident birthdays in 1000 people: very rare pbirthday(1000, coincident = 100) # }
Documentation reproduced from package stats, version 3.4.3, License: Part of R 3.4.3

Community examples

Looks like there are no examples yet.