If I know the true distribution of the number of people who are in each category in a population, how can I determine the probability that test on a random sample will have a certain range of positive cases. Specifically suppose there are $n$ people in the population divided among three categories [$x_1$,$x_2$,$x_3$] so that $x_1+x_2+x_3=n$, and I have test where the probability a person in category $x_i$ tests positive is $p_i$. If I take a random sample of size $m$, how can I determine the probability that the number of positive tests will be in some range?

  • $\begingroup$ Have you already determined what the probability is that one person tests positive (situation where m=1)? $\endgroup$
    – Jeroen
    Nov 10, 2020 at 8:52

1 Answer 1


Let's denote by $T$ the number of positive tests in your sample, and by $T_1, T_2$ and $T_3$ the number of positive tests in categories 1, 2 and 3. Then $T = T_1 + T_2 + T_3$.

First, let's consider that $x_1, x_2, x_3$ are fixed. Then $T_1, T_2$ and $T_3$ are independent binomial random variables : $$\begin{array}{ccc} T_1 & \sim & \mathcal{B}(x_1, p_1)\\ T_2 & \sim & \mathcal{B}(x_2, p_2) \\ T_3 & \sim & \mathcal{B}(x_3, p_3) \end{array}$$ So $T$, is... the sum of three independent binomial random variables (not much more we can say if you don't have $p_1 = p_2 = p_3$). I think you can easily get the probability distribution of $T$ numerically, but not in closed form. However, if $x_1\times p_1$, $x_2 \times p_2$ and $x_3 \times p_3$ are big enough, you can approximate these binomial distributions by normal distributions : $$\begin{array}{ccc} T_1 & \sim & \mathcal{N}\left(x_1 p_1, x_1 p_1 (1-p_1)\right)\\ T_2 & \sim & \mathcal{N}\left(x_2 p_2, x_2 p_2 (1 - p_2)\right) \\ T_3 & \sim & \mathcal{N}\left(x_3 p_3, x_3 p_3 (1 - p_3)\right) \end{array}$$ such that $T\sim\mathcal{N}\left(x_1 p_1 + x_2 p_2 + x_3 p_3, x_1 p_1 (1 - p_1)+ x_2 p_2 (1 - p_2) + x_3 p_3 (1 - p_3)\right)$.

Now, let's take into account the fact that $x_1, x_2$ and $x_3$ are not fixed but realizations of random variables $X_1, X_2, X_3$ whose joint distribution is a multinomial (or polytomous) with parameters $n, p_1, p_2, p_3$. Then $$P[T = t] = \mathbb{E}_{X_1, X_2, X_3}[P(T = t \mid X_1, X_2, X_3)]$$ where the conditionnal probability is given either by the sum of binomials if you don't want to use the normal approximations, either by the normal density of $T$ above if you can use the approximation.

This expectation can be computed numerically by simulations or by numerical integration methods. Unfortunately, I don't think it can easily be computed analytically.

Hope this is helpful.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.