Thus far, all of our definitions and examples concerned discrete random variables, but the definitions and examples can be easily modified for continuous random variables. That's what we'll do now!
- Conditional Probability Density Function of \(Y\) given \(X=x\)
-
Suppose \(X\) and \(Y\) are continuous random variables with joint probability density function \(f(x,y)\) and marginal probability density functions \(f_X(x)\) and \(f_Y(y)\), respectively. Then, the conditional probability density function of \(Y\) given \(X=x\) is defined as:
\(h(y|x)=\dfrac{f(x,y)}{f_X(x)}\)
provided \(f_X(x)>0\). The conditional mean of \(Y\) given \(X=x\) is defined as:
\(E(Y|x)=\int_{-\infty}^\infty yh(y|x)dy\)
The conditional variance of \(Y\) given \(X=x\) is defined as:
\(Var(Y|x)=E\{[Y-E(Y|x)]^2|x\}=\int_{-\infty}^\infty [y-E(Y|x)]^2 h(y|x)dy\)
or, alternatively, using the usual shortcut:
\(Var(Y|x)=E[Y^2|x]-[E(Y|x)]^2=\left[\int_{-\infty}^\infty y^2h(y|x)dy\right]-\mu^2_{Y|x}\)
Although the conditional p.d.f., mean, and variance of \(X\), given that \(Y=y\), is not given, their definitions follow directly from those above with the necessary modifications. Let's take a look at an example involving continuous random variables.
Example 20-3 Section
Suppose the continuous random variables \(X\) and \(Y\) have the following joint probability density function:
\(f(x,y)=\dfrac{3}{2}\)
for \(x^2\le y\le 1\) and \(0<x<1\). What is the conditional distribution of \(Y\) given \(X=x\)?
Solution
We can use the formula:
\(h(y|x)=\dfrac{f(x,y)}{f_X(x)}\)
to find the conditional p.d.f. of \(Y\) given \(X\). But, to do so, we clearly have to find \(f_X(x)\), the marginal p.d.f. of \(X\) first. Recall that we can do that by integrating the joint p.d.f. \(f(x,y)\) over \(S_2\), the support of \(Y\). Here's what the joint support \(S\) looks like:
So, we basically have a plane, shaped like the support, floating at a constant \(\frac{3}{2}\) units above the \(xy\)-plane. To find \(f_X(x)\) then, we have to integrate:
\(f(x,y)=\dfrac{3}{2}\)
over the support \(x^2\le y\le 1\). That is:
\(f_X(x)=\int_{S_2}f(x,y)dy=\int^1_{x^2} 3/2dy=\left[\dfrac{3}{2}y\right]^{y=1}_{y=x^2}=\dfrac{3}{2}(1-x^2)\)
for \(0<x<1\). Now, we can use the joint p.d.f \(f(x,y)\) that we were given and the marginal p.d.f. \(f_X(x)\) that we just calculated to get the conditional p.d.f. of \(Y\) given \(X=x\):
\( h(y|x)=\dfrac{f(x,y)}{f_X(x)}=\dfrac{\frac{3}{2}}{\frac{3}{2}(1-x^2)}=\dfrac{1}{(1-x^2)},\quad 0<x<1,\quad x^2 \leq y \leq 1\)
That is, given \(x\), the continuous random variable \(Y\) is uniform on the interval \((x^2, 1)\). For example, if \(x=\frac{1}{4}\), then the conditional p.d.f. of \(Y\) is:
\( h(y|1/4)=\dfrac{1}{1-(1/4)^2}=\dfrac{1}{(15/16)}=\dfrac{16}{15}\)
for \(\frac{1}{16}\le y\le 1\). And, if \(x=\frac{1}{2}\), then the conditional p.d.f. of \(Y\) is:
\( h(y|1/2)=\dfrac{1}{1-(1/2)^2}=\dfrac{1}{1-(1/4)}=\dfrac{4}{3}\)
for \(\frac{1}{4}\le y\le 1\).
What is the conditional mean of \(Y\) given \(X=x\)? Section
Solution
We can find the conditional mean of \(Y\) given \(X=x\) just by using the definition in the continuous case. That is:
Note that given that the conditional distribution of \(Y\) given \(X=x\) is the uniform distribution on the interval \((x^2,1)\), we shouldn't be surprised that the expected value looks like the expected value of a uniform random variable!
Let's take the case where \(x=\frac{1}{2}\). We previously showed that the conditional distribution of \(Y\) given \(X=\frac{1}{2}\) is
\( h(y|1/2)=\dfrac{1}{1-(1/2)^2}=\dfrac{1}{1-(1/4)}=\dfrac{4}{3}\)
for \(\frac{1}{4}\le y\le 1\). Now, we know that the conditional mean of \(Y\) given \(X=\frac{1}{2}\) is:
\(E(Y|\dfrac{1}{2})=\dfrac{1+(1/2)^2}{2}=\dfrac{1+(1/4)}{2}=\dfrac{5}{8}\)
If we think again of the expected value as the fulcrum at which the probability mass is balanced, our results here make perfect sense: