If I have a Poisson-Binomial random variable $X$ built from $n$ trials where I draw each $p_i$ as either $a \in \left[0, 1 \right]$ or $b \in \left[0, 1 \right]$ with equal probability. How can I find the mean and variance of $X$ in terms of $a$ and $b$? Are there any general techniques I could use?

This question seems relevant, though it's almost going in the other direction.

Edit: Just to clarify, imagine I'm performing $n = 6$ trials and I have $5$ samples. For each trial, I'll first flip a coin to decide if I should use $p_i = a$ or $p_i = b$, then I'll do the trial itself. So if I have $n = 6$ trials, my success probabilities for the first sample I take of this Poisson-Binomial random variable could be $\vec{p}_1 = \left[a, a, a, b, b, a \right]$.

The second might be $\vec{p}_2 = \left[b, a, b, b, a, a \right]$, and so on. Each time I sample the random variable $X$, I'm using different success probabilities $p_i$ that are themselves drawn from a distribution.

  • 2
    $\begingroup$ I cannot understand your setup, because you don't tell us how $p_i$ might be related to $a$ or $b.$ Could you describe it differently or perhaps give an example? $\endgroup$
    – whuber
    Jun 27, 2023 at 20:00
  • $\begingroup$ @whuber I expanded on the question to give a concrete example of what I'm imagining. Essentially, $p_i$ is either $a$ or $b$ with equal probability in this setup. $\endgroup$
    – Germ
    Jun 27, 2023 at 20:20
  • 1
    $\begingroup$ I am not sure what you mean by "$5$ samples". Each of the $6$ components of $X$ seems to have probability $\frac12a+\frac12b$ of being $1$ and is otherwise $0$. So the sum of $6$ iid copies of this is binomial with mean $3(a+b)$ and variance $\frac32(a+b)(1-a-b)$ $\endgroup$
    – Henry
    Jun 27, 2023 at 20:25
  • $\begingroup$ @Henry, I was thinking of "$5$ samples" in terms of trying to estimate the mean and variance of this random variable using only the outcomes. $\endgroup$
    – Germ
    Jun 27, 2023 at 20:53

1 Answer 1


You describe a two stage experiment: first draw the $n$ success probabilities $p_1,\dots, p_n$ from $\{a,b\}$ with equal probability, then draw $X$ as a Poisson binomial given the probabilities. To get mean and variance for this doubly stochastic variable, you can condition on the outcome of the first part of your experiment and then average, use the law of total expectation and law of total variance.

Let $N_a$ be the number of probabilities $p_i=a$ in the first stage. Then $N_a\sim \mathrm{Bin}(n, \frac{1}{2})$. This gives

\begin{aligned} \mathrm{E}X &= \mathrm{E}[\mathrm{E}(X|N_a)] \\&=\mathrm{E}[N_a a + (n-N_a)b] \\&=\frac{n}{2}(a+b), \end{aligned} and \begin{aligned} \mathrm{Var}X &= \mathrm{E}[\mathrm{Var}(X|N_a)] + \mathrm{Var}[\mathrm{E}(X|N_a)] \\&=\mathrm{E}[N_a a(1-a) + (n-N_a)b(1-b)] + \mathrm{Var}[a\cdot N_a + b(n-N_a)] \\&=\frac{n}{2}[a(1-a)+b(1-b)] + \frac{n}{4}(a-b)^2 \\& = n\cdot \frac{a+b}{2}\cdot \left(1-\frac{a+b}{2}\right). \end{aligned}

This result could have been derived in a much more simple way, by looking at the probability that you get a success for the $i$-th outcome after sampling the probability and then the actual Bernoulli trial, as suggested in the comment by @Henry. Then you have a probability $(a+b)/2$ for success on each of the $n$ trials :-).

  • $\begingroup$ Thanks for the explanation! I like this technique because it seems somewhat general. I could modify the initial stage of the experiment to follow some other distribution, and I could do the same kind of calculation as here (with different results). Do I have this right? $\endgroup$
    – Germ
    Jun 28, 2023 at 13:46
  • 1
    $\begingroup$ Yes, you are right, but it would still simplify to binomial if you use the same distribution for all $i=1,\dots,n$ and sample the $p_i$ independently. But these laws of total mean / total variance often come in handy - I probably use them too routinely and did a bit of overkill in the start. Good tools, anyway. $\endgroup$
    – Ute
    Jun 28, 2023 at 13:51

Your Answer

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

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