birthday.ipsur {RcmdrPlugin.IPSUR} | R Documentation |
This is a modified version of the pbirthday
and qbirthday
functions in the stats
package.
Computes approximate answers to a generalised “birthday paradox”
problem. pbirthday.ipsur
computes the probability of a coincidence
and qbirthday.ipsur
computes the number of observations needed to
have a specified probability of coincidence.
The change is that precise answers are given (instead of asymptotics)
in the case of exactly two coincidences.
qbirthday.ipsur(prob = 0.5, classes = 365, coincident = 2) pbirthday.ipsur(n, classes = 365, coincident = 2)
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 |
The birthday paradox is that a very small number of people, 23, suffices to have a 50-50 chance that two 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 is approximate, except in the case coincident=2
.
qbirthday.ipsur |
Number of people needed for a probability prob that k of
them have the same one out of classes equiprobable labels.
|
pbirthday.ipsur |
Probability of the specified coincidence. |
Diaconis P, Mosteller F., “Methods for studying coincidences”. JASA 84:853-861
## the standard version qbirthday.ipsur() ## same 4-digit PIN number qbirthday.ipsur(classes=10^4) ## 0.9 probability of three coincident birthdays qbirthday.ipsur(coincident=3, prob=0.9) ## Chance of 4 coincident birthdays in 150 people pbirthday.ipsur(150,coincident=4) ## 100 coincident birthdays in 1000 people: *very* rare: pbirthday.ipsur(1000, coincident=100)