birthday.problem: Birthday problem

Description Usage Arguments Details Value Examples

Description

What is the probability that N different persons have the same birthdays?

Usage

1
birthday.problem(days, people, gap, repetitions)

Arguments

days

The total number N of possible choices per each occurrency; namely, for K occurrencies the total sample space is N^K. It defaults to the number of days in a regular year, i. e. 365.

people

The number of different cases whose coincidences we want to look at. In the example at hand the number of different people whose birthdays one wants to happen.

gap

The allowed gap between any two different cases. It defaults to 0, namely birthdays happening on the same day.

repetitions

The number of times one wants to repeat the experiment to derive the statistics. It defaults to 20000, that produces a relative error smaller than 0.5% in most relevant cases.

Details

The function also provides the theoretical result, namely the theoretical probability that K cases can occurr simultaneously in the total sample space.

Value

experiment

The frequency of success cases from the experiment, after the selected amount of repetitions.

theory

The theoretical probability value of K cases occurring simultaneously in the total sample space.

Examples

1
2
3
4
## Simultaneous birthdays
birthday.problem(people = 23)
## Birthdays one day apart
birthday.problem(people = 23, gap = 1)

gennaro-tedesco/Rdice documentation built on May 17, 2019, 1:11 a.m.