search for: pbirthday2

Displaying 1 result from an estimated 1 matches for "pbirthday2".

Did you mean: pbirthday
2020 May 22
1
pbirthday() for larger number of classes
...se 0. For large c, sum(log1p(-(1:(n-1))/c)) is close to 0, so a more robust version would be to return if(n >= 2) -expm1(sum(log1p(-(1:(n-1))/c))) else 0 in the default case 'coincident = 2' (internally: if (k == 2) ...). ## Auxiliary function *just* considering 'coincident = 2' pbirthday2 <- function(n, classes = 365) { c <- classes # as pbirthday() if(n >= 2) -expm1(sum(log1p(-(1:(n-1))/c))) else 0 # return value suggested for the case 'if (k == 2) ...' } pbirthday (3, classes = 2) == pbirthday2(3, classes = 2) # identical pbirthday (3, classes = 2^53) ==...