4
$\begingroup$

For two random variables $x$ and $y$, if I can sample from the joint distribution $p(x, y)$, I can obtain samples from the marginal $p(x)$ by sampling from the joint distribution and ignoring the values of $y$. I want to make a formal argument for this. Something like:

$$ \begin{align} \mathbb{E}_{x \sim p(x)} [f(x)] &= \int_{x \in \mathcal{X}} f(x)\,p(x)\,dx \\ &= \int_{x \in \mathcal{X}} f(x)\,\int_{y \in \mathcal{Y}} p(x, y)\,dy\,dx \\ &= \int_{x \in \mathcal{X}} \int_{y \in \mathcal{Y}} f(x)\,p(x, y)\,dy\,dx \\ &= \mathbb{E}_{x, y \sim p(x, y)} [f(x)] \end{align} $$

Is this a reasonable argument?

$\endgroup$

1 Answer 1

4
$\begingroup$

Yes, this is fine. To add some detail: for the second equality, you've used that $\int_y p(x,y)\,dy = p(x)$ for all $x$. The third is justified since $f(x)$ is just a constant as far as $\int_y$ cares. And for the last line, to move to the joint integral you might invoke Fubini-Tonelli.

$\endgroup$
1
  • 1
    $\begingroup$ Thanks for the additional info! $\endgroup$
    – cheersmate
    May 24, 2019 at 7:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .