# Compound distribution in Bayesian sense vs. compound distribution as random sum

I'm trying to sort out two different uses of the term "compound distribution" and figure out the relationship.

The Wikipedia article on compound distribution -- which I wrote -- defines a compound distribution as an infinite mixture, i.e. if $p(x|a)$ is a distribution of type F, and $p(a|b)$ is a distribution of type G, then $p(x|b) = \int_a p(x|a) p(a|b) da$ is a compound distribution that results from compounding F with G. This is the distribution of prior and posterior predictive distributions in Bayesian statistics.

However, the term "compound distribution" has another meaning as a random sum, i.e. a sum of i.i.d. variables where the number of variables is random.

What's the relation between the two? And am I using "compound distribution" correctly for the first definition?

The only relationship between the two compound types I am aware of is with a Bernoulli random variable. If the number of summands in the random sum is Bernoulli then the distribution of the sum is $0$ if the Bernoulli was $0$ and $X_1$ if the Bernoulli was $1$. This is equivalently written
$Y\stackrel{d}{=}Z_1X_1\stackrel{d}{=}\sum_{i=1}^{Z_1}X_1.$ Now the distribution of $Y$ after evaluating the sum has a zero-inflated distribution where the zero inflation is $\Pr(Z_1=0)$. This is the same distribution as if you "compounded" because the product representation above can be interpreted as a scale mixture where you mix between a $0$ value and a value given by the scale parameter of the distribution of $X_1$. The marginal distribution here would require compounding. In this case the compounding is not an integral but a finite sum.