Dear all
I have come across the following problem with pbirthday: (I have observed this in R 1.9.1 and R 2.0.1 on the Windows OS)
As I understand it, pbirthday(n,c,k) gives the approximate probability that we see a class with k coicident people in it when n people are sorted into c classes.
so the command
pbirthday(4,classes=3,coincident=4)
should give the approximate probability that when four people fall into three classes, all four end up in the same class. A probability that is clearly lower than the presently returned value of 1.
It seems to me that the line in the function
if (n > classes) return(1)
is only relevant to the default case of coincident = 2. (Naturally, if there are more people than classes, then at least one class must contain 2 people).
Since the pbirthday function has been generalized to accept other values for coincidence
if (n > (classes * (coincident-1))) return(1)
would seem to me to be (one version of) the necessary line.
Alternatively I could be getting entirely the wrong end of the stick.
If you could either confirm or disabuse then I would be grateful
Yours
Andy Lynch
Centre for Applied Medical Statistics Department of Public Health and Primary Care University of Cambridge Institute of Public Health
______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html