[Math] Integral of conditional probability density function

estimationprobabilityprobability theory

As far as I understand, when we fix the condition for the conditional density, we get probability distribution and the integral over all the space is $1$ $P(X|Y=y_0)$:

$$\int_{\mathbb{R}}f_{X \mid Y}(x \mid y=y_0)dx=P(X|Y=y_0)<1 $$

However, suppose we want to take integral:

$$\int_{\mathbb{R}}\bigg(\int_{\mathbb{R}}f_{X \mid Y}(x \mid y)dx\bigg)dy $$

I thought it is equal to $1$, but approximate numerical computation through summation for continuous conditional density
$$\sum_{i=1}^N \sum_{j=1}^N f_{X\mid Y}(a+\frac{b-a}{N}i \ \ \big| \ \ a+\frac{b-a}{N}j)\cdot(\frac{b-a}{N})^2 $$
gives very big values, e.g. $3000$ or even $1e+25$.

Best Answer

When you integrate the conditional density of $X$ given $Y=y$ over all $x$, you should get $1$: $$ \int_{\mathbb{R}}f_{X \mid Y}(x \mid Y=y)dx = 1\tag1 $$ because you've just computed $P(X\in\mathbb{R}\mid Y=y)$. This is true for every value of $y$. So when you attempt to integrate (1) over all values of $y$, you'll be integrating the constant $1$. The result doesn't need to equal $1$. If $Y$ is discrete, you'll be essentially counting the number of possible values for $Y$.

Related Question