## Another Example of a Joint Distribution

In an earlier post called An Example of a Joint Distribution, we worked a problem involving a joint distribution that is constructed from taking product of a conditional distribution and a marginial distribution (both discrete distributions). In this post, we work on similar problems for the continuous case. We work problem A. Problem B is left as exercises.

_________________________________________________________________

Problem A
Let $X$ be a random variable with the density function $f_X(x)=\alpha^2 \ x \ e^{-\alpha x}$ where $x>0$. For each realized value $X=x$, the conditional variable $Y \lvert X=x$ is uniformly distributed over the interval $(0,x)$, denoted symbolically by $Y \lvert X=x \sim U(0,x)$. Obtain solutions for the following:

1. Discuss the joint density function for $X$ and $Y$.
2. Calculate the marginal distribution of $X$, in particular the mean and variance.
3. Calculate the marginal distribution of $Y$, in particular, the density function, mean and variance.
4. Use the joint density in part A-1 to calculate the covariance $Cov(X,Y)$ and the correlation coefficient $\rho$.

_________________________________________________________________

Problem B
Let $X$ be a random variable with the density function $f_X(x)=4 \ x^3$ where $0. For each realized value $X=x$, the conditional variable $Y \lvert X=x$ is uniformly distributed over the interval $(0,x)$, denoted symbolically by $Y \lvert X=x \sim U(0,x)$. Obtain solutions for the following:

1. Discuss the joint density function for $X$ and $Y$.
2. Calculate the marginal distribution of $X$, in particular the mean and variance.
3. Calculate the marginal distribution of $Y$, in particular, the density function, mean and variance.
4. Use the joint density in part B-1 to calculate the covariance $Cov(X,Y)$ and the correlation coefficient $\rho$.

_________________________________________________________________

Discussion of Problem A

Problem A-1

The support of the joint density function $f_{X,Y}(x,y)$ is the unbounded lower triangle in the xy-plane (see the shaded region in green in the figure below).

Figure 1

The unbounded green region consists of vertical lines: for each $x>0$, $y$ ranges from $0$ to $x$ (the red vertical line in the figure below is one such line).

Figure 2

For each point $(x,y)$ in each vertical line, we assign a density value $f_{X,Y}(x,y)$ which is a positive number. Taken together these density values sum to 1.0 and describe the behavior of the variables $X$ and $Y$ across the green region. If a realized value of $X$ is $x$, then the conditional density function of $Y \lvert X=x$ is:

$\displaystyle f_{Y \lvert X=x}(y \lvert x)=\frac{f_{X,Y}(x,y)}{f_X(x)}$

Thus we have $f_{X,Y}(x,y) = f_{Y \lvert X=x}(y \lvert x) \times f_X(x)$. In our problem at hand, the joint density function is:

\displaystyle \begin{aligned} f_{X,Y}(x,y)&=f_{Y \lvert X=x}(y \lvert x) \times f_X(x) \\&=\frac{1}{x} \times \alpha^2 \ x \ e^{-\alpha x} \\&=\alpha^2 \ e^{-\alpha x} \end{aligned}

As indicated above, the support of $f_{X,Y}(x,y)$ is the region $x>0$ and $0 (the region shaded green in the above figures).

Problem A-2

The unconditional density function of $X$ is $f_X(x)=\alpha^2 \ x \ e^{-\alpha x}$ (given above in the problem) is the density function of the sum of two independent exponential variables with the common density $f(x)=\alpha e^{-\alpha x}$ (see this blog post for the derivation using convolution method). Since $X$ is the independent sum of two identical exponential distributions, the mean and variance of $X$ is twice that of the same item of the exponential distribution. We have:

$\displaystyle E(X)=\frac{2}{\alpha}$

$\displaystyle Var(X)=\frac{2}{\alpha^2}$

Problem A-3

To find the marginal density of $Y$, for each applicable $y$, we need to sum out the $x$. According to the following figure, for each $y$, we sum out all $x$ values in a horizontal line such that $y (see the blue horizontal line).

Figure 3

Thus we have:

\displaystyle \begin{aligned} f_Y(y)&=\int_y^\infty f_{X,Y}(x,y) \ dy \ dx \\&=\int_y^\infty \alpha^2 \ e^{-\alpha x} \ dy \ dx \\&=\alpha \int_y^\infty \alpha \ e^{-\alpha x} \ dy \ dx \\&= \alpha e^{-\alpha y} \end{aligned}

Thus the marginal distribution of $Y$ is an exponential distribution. The mean and variance of $Y$ are:

$\displaystyle E(Y)=\frac{1}{\alpha}$

$\displaystyle Var(Y)=\frac{1}{\alpha^2}$

Problem A-4

The covariance of $X$ and $Y$ is defined as $Cov(X,Y)=E[(X-\mu_X) (Y-\mu_Y)]$, which is equivalent to:

$\displaystyle Cov(X,Y)=E(X Y)-\mu_X \mu_Y$

where $\mu_X=E(X)$ and $\mu_Y=E(Y)$. Knowing the joint density $f_{X,Y}(x,y)$, we can calculate $Cov(X,Y)$ directly. We have:

\displaystyle \begin{aligned} E(X Y)&=\int_0^\infty \int_0^x xy \ f_{X,Y}(x,y) \ dy \ dx \\&=\int_0^\infty \int_0^x xy \ \alpha^2 \ e^{-\alpha x} \ dy \ dx \\&=\int_0^\infty \frac{\alpha^2}{2} \ x^3 \ e^{-\alpha x} \ dy \ dx \\&= \frac{3}{\alpha^2} \int_0^\infty \frac{\alpha^4}{3!} \ x^{4-1} \ e^{-\alpha x} \ dy \ dx \\&= \frac{3}{\alpha^2} \end{aligned}

Note that the last integrand in the last integral in the above derivation is that of a Gamma distribution (hence the integral is 1.0). Now the covariance of $X$ and $Y$ is:

$\displaystyle Cov(X,Y)=\frac{3}{\alpha^2}-\frac{2}{\alpha} \frac{1}{\alpha}=\frac{1}{\alpha^2}$

The following is the calculation of the correlation coefficient:

\displaystyle \begin{aligned} \rho&=\frac{Cov(X,Y)}{\sigma_X \ \sigma_Y} = \frac{\displaystyle \frac{1}{\alpha^2}}{\displaystyle \frac{\sqrt{2}}{\alpha} \ \frac{1}{\alpha}} \\&=\frac{1}{\sqrt{2}} = 0.7071 \end{aligned}

Even without the calculation of $\rho$, we know that $X$ and $Y$ are positively and quite strongly correlated. The conditional distribution of $Y \lvert X=x$ is $U(0,x)$ which increases with $x$. The calculation of $Cov(X,Y)$ and $\rho$ confirms our observation.

_________________________________________________________________

Answers for Problem B

Problem B-1

$\displaystyle f_{X,Y}(x,y)=4 \ x^2$ where $x>0$, and $0.

Problem B-2

$\displaystyle E(X)=\frac{4}{5}$
$\displaystyle Var(X)=\frac{2}{75}$

Problem B-3

$\displaystyle f_Y(y)=\frac{4}{3} \ (1- y^3)$

$\displaystyle E(Y)=\frac{2}{5}$

$\displaystyle Var(Y)=\frac{14}{225}$

Problem B-4

$\displaystyle Cov(X,Y)=\frac{1}{75}$

$\displaystyle \rho = \frac{\sqrt{3}}{2 \sqrt{7}}=0.327327$

_________________________________________________________________