Re: [Rd] pbirthday() for larger number of classes

2020-05-22 Thread Marius Hofert
... and one should include the pigeonhole principle: pbirthday2 <- function(n, classes = 365) { c <- classes # as pbirthday() if(n >= 2) { if(n > classes) 1 else -expm1(sum(log1p(-(1:(n-1))/classes))) } else 0 } __ R-devel@r-project.

[Rd] pbirthday() for larger number of classes

2020-05-22 Thread Marius Hofert
Hi, pbirthday(, coincident = 2) starts to issue warnings (see (*) below) for larger number of classes (R 4.0.0, R-devel ./src/library/stats/R/birthday.R:47). The default coincident = 2 is computed as 1 - prod((c:(c - n + 1))/rep(c, n)) where c = classes. Using exp(log(...)), one can derive the re