The expectation and variance in case of dependency

43 Views Asked by At

I have the following question:

We have that $$Z = IB + (1-I)0$$ and $$P(I=1)=q , P(I=0)=1-q$$ Now calculate the expectation and variance of Z and don't assume that B and I are independent.

The E[Z] was not hard to find:

$$E[Z] = E[IB] = E[E[IB|I]] = E[IE[B|I]] = E[I]E[B|I] = qE[B|I].$$

Using the following rule Var[Z] = E[Var(Z|I)] + Var(E[Z|I]) we should be able to obtain the variance of Z.

$$Var(E[Z|I]) = Var( IE[B|I]) = E[B|I]^2 Var(I) = E[B|I]^2*q(1-q)$$

Now, I have problems with the other term... I know that $$Var(Z|I) = I^2 Var(B)$$ so $$E[Var(Z|I)] = E[I^2 Var(B)]$$

However, the final answer should be: $$Var[Z] = q Var(B) + q (1-q) E[B]^2$$

Now, I don't understand these last steps:

$$E[I^2 Var(B)]=Var(B)Var(I^2)=qVar(B)$$

Can anyone tell me how these last steps work? Thanks!