What is the variance of a binomial distribution with random number of trials? According to Wikipedia (https://en.wikipedia.org/wiki/Binomial_distribution), the variance of a binomial distribution of $n$ independent trials, where each trial has an outcome probability of $p$, is given by $np(1-p)$.
But what is the overall variance of the distribution if the number of trials $n$ is itself a binomial distribution having a mean value of $m$ and a variance of $v$?
For background information, I'm trying to build an Excel model of projects flowing through successive phases of drug development, where a binomial distribution of projects starts one phase, and the probability that each project passes into the next phase is given by $p$, so I want to forecast the distribution (mean and variance) of projects passing from one phase to the next.
 A: Your hierarchical model is underspecified.  If $N$ is binomial with variance $v$, this does not uniquely specify $N$.
Instead, suppose we have $X \mid N \sim \operatorname{Binomial}(N,p)$ and $N \sim \operatorname{Binomial}(n,\theta)$.  We find by the law of total variance $$\begin{align*} \operatorname{Var}[X] 
&= \operatorname{Var}[\operatorname{E}[X \mid N]] + \operatorname{E}[\operatorname{Var}[X \mid N]] \\
&= \operatorname{Var}[Np] + \operatorname{E}[Np(1-p)] \\
&= p^2 \operatorname{Var}[N] + p(1-p)\operatorname{E}[N] \\
&= p^2 n\theta(1-\theta) + p(1-p) n\theta \\
&= np\theta (p(1-\theta) + (1-p)) \\
&= np\theta (1-p\theta). \end{align*}$$  This of course, is the variance of a binomial distribution with parameters $n$ and $p\theta$.  Since by the law of total expectation we also have $$\operatorname{E}[X] = \operatorname{E}[\operatorname{E}[X \mid N]] = \operatorname{E}[Np] = np\theta,$$ this suggests (but does not prove) that the marginal distribution of $X$ could be binomial.  Can you prove or disprove the claim $$X \overset{?}{\sim} \operatorname{Binomial}(n,p\theta)?$$
