Question: Y~ Uniform (0,1) and given Y=y, random variable X is binomial with parameters n and y. Find the transform (moment generating function) of X. Does X have a special name?
Attempt: I was trying to find the conditional transform first, i.e. M(x|y) (s) = E(e^sx | Y) = (1-y+ye^s)^n (as X|Y is a binomial RV) And I was thinking about the law of Iterated Expectation: E[X] = E[E(X|Y)], but I am not sure how to go further from here.
Am I on the right track? Any ideas on how to do this problem? Thanks a lot!
The conditional MGF of $X$ given $Y$ is $\mathbb E[e^{sX}|Y] = (Y (e^s-1) + 1)^n$, so the unconditional MGF is $$\eqalign{\mathbb E[e^{sX}] &= \mathbb E \left[ (Y (e^s-1)+1)^n\right]\cr &= \int_0^1 (y (e^s-1)+1)^n\; dy\cr &= \dfrac{e^{(n+1)s} - 1}{(n+1)(e^s-1)}}$$ Since $e^{(n+1)s} - 1 = (e^s - 1)(e^{ns} + e^{(n-1)s} + \ldots + 1)$, this does match the MGF of the discrete uniform distribution on $0, \ldots, n$.