Suppose we know the distribution of a variable $x$ is $g(X)$, and we also know the conditional distribution of a variable $y$ given $x$ is $f(y|x)$. It has been shown that (such as in this book, p. 52 ) by
After $n$ draws, the quantities $y_1,...,y_n$ are an iid sample from the marginal density $J(y)$. I understand that the pairs $(x_1,y_1),...,(x_n,y_n)$ are an iid sample from the joint distribution $Q(x,y)$, but I still try to figure out the intuition/theory about why $y_1,...,y_n$ are an iid sample from the marginal density $J(y)$. Can anyone help? Thanks.
p.s. I know the answer to this thread explains it but I still don't get why ignoring $x$'s equals to integrating out them.