Another Example on Calculating Covariance

In a previous post called An Example on Calculating Covariance, we calculated the covariance and correlation coefficient of a discrete joint distribution where the conditional mean E(Y \lvert X=x) is a linear function of x. In this post, we give examples in the continuous case. Problem A is worked out and Problem B is left as exercise.

The examples presented here are also found in the post called Another Example of a Joint Distribution. Some of the needed calculations are found in this previous post.

____________________________________________________________________

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. Calculate the density function, the mean and the variance for the conditional variable Y \lvert X=x.
  2. Calculate the density function, the mean and the variance for the conditional variable X \lvert Y=y.
  3. Use the fact that the conditional mean E(Y \lvert X=x) is a linear function of x 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<x<1. 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. Calculate the density function, the mean and the variance for the conditional variable Y \lvert X=x.
  2. Calculate the density function, the mean and the variance for the conditional variable X \lvert Y=y.
  3. Use the fact that the conditional mean E(Y \lvert X=x) is a linear function of x to calculate the covariance Cov(X,Y) and the correlation coefficient \rho.

____________________________________________________________________

Background Results

Here’s the idea behind the calculation of correlation coefficient in this post. Suppose X and Y are jointly distributed. When the conditional mean E(Y \lvert X=x) is a linear function of x, that is, E(Y \lvert X=x)=a+bx for some constants a and b, it can be written as the following:

    \displaystyle E(Y \lvert X=x)=\mu_Y + \rho \ \frac{\sigma_Y}{\sigma_X} \ (x - \mu_X)

Here, \mu_X=E(X) and \mu_Y=E(Y). The notations \sigma_X and \sigma_Y refer to the standard deviation of X and Y, respectively. Of course, \rho refers to the correlation coefficient in the joint distribution of X and Y and is defined by:

    \displaystyle \rho=\frac{Cov(X,Y)}{\sigma_X \ \sigma_Y}

where Cov(X,Y) is the covariance of X and Y and is defined by

    Cov(X,Y)=E[(X-\mu_X) \ (Y-\mu_Y)]

or equivalently by Cov(X,Y)=E(X,Y)-\mu_X \mu_Y.

Just to make it clear, in the joint distribution of X and Y, if the conditional mean E(X \lvert Y=y) is a linear function of y, then we have:

    \displaystyle E(X \lvert Y=y)=\mu_X + \rho \ \frac{\sigma_X}{\sigma_Y} \ (y - \mu_Y)

____________________________________________________________________

Discussion of Problem A

Problem A-1

Since for each x, Y \lvert X=x has the uniform distribution U(0,x), we have the following:

    \displaystyle f_{Y \lvert X=x}=\frac{1}{x} for x>0

    \displaystyle E(Y \lvert X=x)=\frac{x}{2}

    \displaystyle Var(Y \lvert X=x)=\frac{x^2}{12}

Problem A-2

In a previous post called Another Example of a Joint Distribution, the joint density function of X and Y is calculated to be: f_{X,Y}(x,y)=\alpha^2 \ e^{-\alpha x}. In the same post, the marginal density of Y is calculated to be: f_Y(y)=\alpha e^{-\alpha y} (exponentially distributed). Thus we have:

    \displaystyle \begin{aligned} f_{X \lvert Y=y}(x \lvert y)&=\frac{f_{X,Y}(x,y)}{f_Y(y)} \\&=\frac{\alpha^2 \ e^{-\alpha x}}{\alpha \ e^{-\alpha \ y}} \\&=\alpha \ e^{-\alpha \ (x-y)} \text{ where } y<x<\infty \end{aligned}

Thus the conditional variable X \lvert Y=y has an exponential distribution that is shifted to the right by the amount y. Thus we have:

    \displaystyle E(X \lvert Y=y)=\frac{1}{\alpha}+y

    \displaystyle Var(Y \lvert X=x)=\frac{1}{\alpha^2}

Problem A-3

To compute the covariance Cov(X,Y), one approach is to use the definition indicated above (to see this calculation, see Another Example of a Joint Distribution). Here we use the idea that the conditional mean \displaystyle E(Y \lvert X=x) is linear in x. From the previous post Another Example of a Joint Distribution, we have:

    \displaystyle \sigma_X=\frac{\sqrt{2}}{\alpha}

    \displaystyle \sigma_Y=\frac{1}{\alpha}

Plugging in \sigma_X and \sigma_Y, we have the following calculation:

    \displaystyle \rho \ \frac{\sigma_Y}{\sigma_X}=\frac{1}{2}

    \displaystyle \rho = \frac{\sigma_X}{\sigma_Y} \times \frac{1}{2}=\frac{\sqrt{2}}{2}=\frac{1}{\sqrt{2}}=0.7071

    \displaystyle Cov(X,Y)=\rho \ \sigma_X \ \sigma_Y=\frac{1}{\alpha^2}

____________________________________________________________________

Answers for Problem B

Problem B-1

    \displaystyle E(Y \lvert X=x)=\frac{x}{2}

    \displaystyle Var(Y \lvert X=x)=\frac{x^2}{12}

Problem B-2

    \displaystyle f_{X \lvert Y=y}(x \lvert y)=\frac{4 \ x^2}{1-y^3} where 0<y<1 and y<x<1

Problem B-3

    \displaystyle \rho=\frac{\sqrt{3}}{2 \ \sqrt{7}}=0.3273268

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

____________________________________________________________________
\copyright \ 2013

About these ads

Tagged: , , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: