Variance of a binomial where the number of draws is a random variable

binomial distributionrandom variables

Suppose I draw $M$ objects where $M \sim \mathrm{Poisson}(\lambda)$. Then for each of the $M$ objects, I decide whether or not to keep it by flipping a coin that lands on heads with probability $p$. At the end of this process, I have $N$ items. Clearly the expectation of $N$ is $\lambda p$. My question is, what is the variance of $N$? I know the variance of a binomial is $np(1-p)$, but I don't know how to proceed when $n$ is a random variable and not just a parameter. My intuition is that the variance will be higher than $\lambda p(1-p)$ but I'm not sure if that's right.

There is a similar question here What is the distribution of a binomial variable where the number of trials is itself random? but I can't quite follow the answers and variance is not discussed.

I'm also interested in the case where the distribution of $M$ is itself binomial.

Best Answer

First observe that

$(N|M=m)\sim Bin(m;p)$

To calculate $\mathbb{E}[N]=\lambda p$ you did

$$\mathbb{E}[N]=\mathbb{E}[\mathbb{E}(N|M=m)]=\mathbb{E}[mp]=p\mathbb{E}[M]=\lambda p$$

Using the fact that $\mathbb{V}(X)=\mathbb{E}[X^2]-\mathbb{E}^2[X]$ you can easily proceed in the same way

$$\mathbb{V}[N]=\mathbb{E}[N^2]-\mathbb{E}^2[N]=\mathbb{E}[\mathbb{E}(N^2|M=m)]-\lambda^2p^2=...=p(1-p)\lambda+\lambda p^2$$

.... Your intuition is right!

I'm also interested in the case where the distribution of M is itself binomial.

I hope the procedure I showed is clear... if yes you can use it in any case...

Edit: law of N

$$\mathbb{P}[N=k]=\sum_{n=k}^{\infty}\binom{n}{k}p^k(1-p)^{n-k}\frac{e^{-\lambda}\lambda^n}{n!}=$$

$$=\frac{(\lambda p)^k}{k!}e^{-\lambda}\sum_{(n-k)=0}^{\infty}\frac{[(1-p)\lambda]^{n-k}}{(n-k)!}= \frac{(\lambda p)^k}{k!}e^{-\lambda}e^{(1-p)\lambda}=\frac{(\lambda p)^k e^{-\lambda p}}{k!}$$

$k=0,1,2,..$

Related Question