Probability generating function of $\sum_{i=1}^N X_i$ where $N$ is a a positive integer r.v.

45 Views Asked by At

Let $X = \sum_{i=1}^N X_i$ where all $X_i$'s are iid and $N$ and $X_i$ are independent where $N$ is a positive-valued integer r.v.

Then the PGF of $X$ is $$G_{X}(s) = \mathbb{E}(s^X) $$ They simplified this down to: $$G_{X}(s) = \mathbb{E}(\prod_{i=1}^N \mathbb{E}(s^{X_i})) \\ = \mathbb{E}(G_{X_i}(s)^N)\\ = G_{N}(G_{X_i}(s)) \\ = \sum_{n=0}^\infty (G_{X_i}(s))^n \mathbb{P}(N=n) $$ My question is: why do they use the probability density function of $N$ to compute the expectation in the end? So how did they go from the third last equality to the second last?
Because it seems unclear whether to use $X_i$ or $N$, since $X_i$ is also a random variable here. Can't I do this: $$ G_{X}(s) = \mathbb{E}(G_{X_i}(s)^N) = \mathbb{E}((\exp(N)))^{\log(G_{X_i}(s))}) $$ and then use the PDF of $X_i$?
I think my question boils down to: how do I know what PDF to use?