I was wondering how I should calculate the variance of the following discrete probability distribution:
$$P(y = 0|X) = w + (1-w)e^{-\mu}$$ $$P(y = j|X) = (1-w)e^{-\mu}\mu^{y}/y! \qquad j=1,2...$$
The variance is supposed to be:
$$Var(y|w, \mu) = (1-w)[\mu + w\mu^{2}]$$
I suppose the total variance is the sum of the variance associated to the case $y=0$ and $y=j$ for $j>0$. Correct me if I'm wrong, but I don't think something like $Var(X + Y) = Var(X)+Var(Y)+Cov(X,Y)$ is appropriate because $y$ is a single random variable which takes several values with distinct probability distributions. However, the $y=0$ case doesn't depend on $y$, so $Var(y=0|w,\mu)$ should be zero. The case $y=j$ could be something like:
$$\sum_{1}^{\infty} (y-(\mu-w \mu))^{2}(1-w)e^{-\mu}\mu^{y}/y!$$
The part $\mu - w\mu$ is due to the expected value of the probability distribution $P(y=j|X)$:
$$\sum_{1}^{\infty} y(1-w)e^{-\mu}\mu^{y}/y!=\mu - w\mu$$
This expected value is correct. However, the value of the variance calculated as I described above, is not correct. It gives a much more complicated expression. Interestingly, summing from $0$ to $\infty$, produces a very similar result to the correct answer:
$$\sum_{0}^{\infty} (y-(\mu-w \mu))^{2}(1-w)e^{-\mu}\mu^{y}/y!=(1-w)\mu(1+w^{2}\mu)$$
By the way, I'm using Mathematica to obtain these results. I'm only interested in the correct approach to obtain this kind of variance, not in the details of the calculation.