Skip to content

Problem with pbirthday (PR#7837)

2 messages · andy.lynch@phpc.cam.ac.uk, Thomas Lumley

#
Full_Name: Andy Lynch
Version: 1.9.1
OS: Windows
Submission from: (NULL) (131.111.86.211)



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
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).
#
On Wed, 4 May 2005 andy.lynch@phpc.cam.ac.uk wrote:

            
Yep, looks like a bug to me.  Thanks.

I do note that the approximation used in pbirthday is not very good for 
small n, so fixing this bug still doesn't give the right answer for your 
example.  For small n the best solution is simulation or direct 
calculation.   The point of the pbirthday approximation is 
that the untrained intuition guesses the probability to be about
    n(1/classes)^(coincident-1) 
and the approximation is usually quite good when this is much smaller than 
the true probability.


 	-thomas