Posterior probability for a unique source after a positive test (source code)

= Posterior probability for a unique source after a positive test
{title2=$P(G\mid+)=[1+(N-1)p]^{-1}$}

Suppose exactly one of $N$ equally likely candidates is the source of an observation. A test is always positive for that source and is positive with probability $p$ for any nonsource candidate. For one randomly selected candidate, <Bayes' theorem> gives $P(G\mid+)=(1/N)/[(1/N)+p(1-1/N)]$, proving the displayed result. Even a small <false positive rate> can leave a substantial chance of a different source when there are many alternatives. The model concerns one selected candidate with the stated prior; searching many candidates and selecting a match requires accounting for that selection procedure.