I was solving a problem where $Y$ is a random variable with Poisson distribution with parameter $\lambda$ and $X \vert Y$ is binomial with parameters $(y,p)$ I need to find the density function, the expected value and variance of $X$.
With the formulas $E(X)=E(E(X \vert Y))$ and $var(X)=E(var(X \vert Y))+var(E(X \vert Y))$ I know that $E(X)=var(X)=p \lambda$.
But my problem is the density function. With the formula $f_{X \vert Y}(x \vert y) =f_{X,Y}(x,y)/f_{Y}(y)$ I compute $f_{X,Y}$ and $f_{X}$ but the density function of $X$ gives me a Poisson with parameter $\lambda$ when I think it should be Poisson with parameter $\lambda p$ from the information of $E(X)$ and $var(X)$. What am I doing wrong?
Evaluate \begin{align*} P[X = k] &= \sum_{j = 0}^\infty P[Y=j]P[X=k|Y=j]\\ &= \sum_{j = k}^\infty e^{-\lambda} \frac{\lambda^j}{j!}\binom{j}{k}p^k(1 - p)^{j - k} \\ &= \frac{e^{-\lambda}p^k \lambda^k}{k!}\sum_{j = k}^\infty \frac{\lambda^{j - k} (1 - p)^{j-k} }{(j-k)!} \\ &=\frac{e^{-\lambda} p^k \lambda^k}{k!} e^{\lambda(1 - p)} \\ &= \frac{e^{-\lambda p} (p\lambda)^k}{k!}\,. \end{align*}