Examples for 'stats::qbirthday'


Probability of coincidences

Aliases: qbirthday pbirthday

Keywords: distribution

### ** Examples

require(graphics)

## the standard version
qbirthday() # 23
[1] 23
## probability of > 2 people with the same birthday
pbirthday(23, coincident = 3)
[1] 0.01441541
## examples from Diaconis & Mosteller p. 858.
## 'coincidence' is that husband, wife, daughter all born on the 16th
qbirthday(classes = 30, coincident = 3) # approximately 18
[1] 18
qbirthday(coincident = 4)  # exact value 187
[1] 187
qbirthday(coincident = 10) # exact value 1181
[1] 1179
## same 4-digit PIN number
qbirthday(classes = 10^4)
[1] 119
## 0.9 probability of three or more coincident birthdays
qbirthday(coincident = 3, prob = 0.9)
[1] 135
## Chance of 4 or more coincident birthdays in 150 people
pbirthday(150, coincident = 4)
[1] 0.2690146
## 100 or more coincident birthdays in 1000 people: very rare
pbirthday(1000, coincident = 100)
[1] 1.531434e-113

[Package stats version 4.2.3 Index]