# 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)
# }
Run the code above in your browser using DataLab