# Mean and variance of binomial distribution

I am working on a question concerning the mean and variance of binomial distribution. The question is as follows.

Let $Y_{1}, Y_{2},…, Y_{n}$ be independent random variables such that $Y_{i}$~$B(m,\pi_{i})$.

Let $Y = Y_{1}+Y_{2}+…+Y_{n}$.

Assume that $\pi_{1}, \pi_{2},…, \pi_{n}$ are independent random variables with common mean $\pi$ and common variance $r^2\pi(1-\pi)$.

Show that, unconditionally,

$E(Y) = mn\pi$

$var(Y)=mn\pi(1-\pi)[1+(m-1)r^2]$

I am not sure how to do this as the parameter of the binomial distribution is a random variable.

Could someone please shed some light on how to do this? Much appreciated if someone could help me.

• Can you please remove the scan and type the exercises using $\LaTeX$? That is the norm here. – kjetil b halvorsen Apr 5 '17 at 5:46
• OK, I will edit my question. – Deepleeqe Apr 5 '17 at 5:53

## 1 Answer

Hint, use laws of total/iterated expectation and variance. For any two random variables $X$ and $Y$ where all the below quantities exist: $$E[X] = E[E(X|Y)]$$ and $$\operatorname{Var}[X] = \operatorname{Var}[E(X|Y)] + E[ \operatorname{Var}(X|Y)].$$

• Taylor, your hint is very useful. I managed to show the required results. Thank you very much. I have one more question. When I do the calculation, I got to calculate $E[\pi(1-\pi)]$ . As I have no distribution function of $\pi$, I assume that $E[\pi(1-\pi)] = E[\pi]-E[\pi^2]$. Is that correct? – Deepleeqe Apr 5 '17 at 6:00
• @Deepleeqe yes that's true by linearity of the expectation – Taylor Apr 5 '17 at 7:18
• Thank you very much for your help Taylor. Really appreciate it. – Deepleeqe Apr 5 '17 at 14:25