From tlumley at u.washington.edu  Wed May  4 16:50:00 2005
From: tlumley at u.washington.edu (Thomas Lumley)
Date: Wed May  4 16:50:38 2005
Subject: [Rd] Problem with pbirthday (PR#7837)
In-Reply-To: <20050504130706.42716A1DA@slim.kubism.ku.dk>
References: <20050504130706.42716A1DA@slim.kubism.ku.dk>
Message-ID: <Pine.A41.4.61b.0505040743220.144940@homer05.u.washington.edu>

On Wed, 4 May 2005 andy.lynch@phpc.cam.ac.uk wrote:

>
> 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).
>

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


[Rd] Problem with pbirthday (PR#7837)
Thomas Lumley