1
$\begingroup$

I would expect the answer to the problem below to be at least $\frac{1}{2}$. However, it is not. Therefore, I am thinking I did something wrong. Did I?

Problem:
Suppose that $X$ is a uniformly distributed random variable over the interval $[-1,1]$. That is, the density function for $X$ is: $$ f(x) = \begin{cases} \frac{1}{2}, & \text{for } {-1} \leq x \leq 1 \\ 0, & \text{otherwise } \end{cases} $$ Now $Y$ is a random variable that follows the triangle distribution. That is, the density function for $Y$ is: $$ g(y) = \begin{cases} y + 1, & \text{for } {-1} \leq y \leq 0 \\ 1 - y, & \text{for } 0 \leq y \leq 1 \\ 0, & \text{otherwise } \end{cases} $$ We generate a value $x_0$ using the density function $f(x)$. We then generate a value $y_0$ using the density function $g(y)$ such that $$ \int_{-1}^{x_0} \frac{1}{2} \, dx = \int_{-1}^{y_0} g(y) \, dy $$ What is the correlation between $X$ and $Y$?

Answer:

The formula for correlation is: $$\rho = \frac{\sigma_{xy}}{ \sigma_x \sigma_y } $$ Observe that the $E(X) = E(Y) = 0$. \begin{align*} E(X^2) &= \int_{-1}^{1} \frac{x^2}{2} \, dx = \frac{x^3}{6} \Big|_{-1}^{1} = \frac{1}{6} - \frac{-1}{6} \\ E(X^2) &= \frac{1}{3} \\ \sigma_x^2 &= E(X^2) - (E(x))^2 = \frac{1}{3} \\ \sigma_x &=\frac{ \sqrt{3} }{3} \\ E(Y^2) &= \int_{-1}^{1} y^2 f(y) \, dy = \int_{-1}^{0} y^2 f(y) \, dy + \int_{0}^{1} y^2 f(y) \, dy \\ \int_{-1}^{0} y^2 (y+1) \, dy &= \int_{-1}^{0} y^3 + y^2 \,\, dy = \frac{y^4}{4} + \frac{y^3}{3} \Big|_{-1}^{0} \\ \int_{-1}^{0} y^2 (y+1) \, dy &= 0 - \left( \frac{1}{4} - \frac{1}{3} \right) \\ \int_{-1}^{0} y^2 (y+1) \, dy &= \frac{1}{12} \\ \sigma_y^2 &= E(Y^2) - (E(y))^2 = \frac{1}{12} \\ \sigma_y &= \frac{1}{\sqrt{12}} = \frac{ \sqrt{3} } {6} \end{align*} Now we need to find $\sigma_{xy}$.To do this, we need to find $E(XY)$. Observe that if $-1\leq x \leq 0$ then the area under the $f(x)$ between $x = -1$ and $x = 0$ is $\left( \frac{1}{2}\right) (x + 1)$. Now we need to find $y$ in terms of $x$. \begin{align*} \left( \frac{1}{2}\right) (x + 1) &= \int_{-1}^{y} y + 1 \, dy = \frac{y^2}{2} + y \Big|_{-1}^{y} \\ \left( \frac{1}{2}\right) (x + 1) &= \frac{y^2}{2} + y - \left( \frac{1}{2} - 1 \right) \\ \left( \frac{1}{2}\right) (x + 1) &= \frac{y^2}{2} + y + \frac{1}{2} \\ x + 1 &= y^2 + 2y + 1 \\ x &= y^2 + 2y \\ E(XY) &= 2 \int_{-1}^{0} (y^2+y)(y)(y+1) \, dy \\ \int_{-1}^{0} (y^2+y)(y)(y+1) \, dy &= \int_{-1}^{0} y^4 + y^3 + y^3 + y^2 \, dy \\ \int_{-1}^{0} (y^2+y)(y)(y+1) \, dy &= \int_{-1}^{0} y^4 + 2y^3 + y^2 \, dy \\ \int_{-1}^{0} (y^2+y)(y)(y+1) \, dy &= \frac{y^5}{5}+ \frac{2y^4}{4} + \frac{y^3}{3} \Big|_{-1}^{0} \\ \int_{-1}^{0} (y^2+y)(y)(y+1) \, dy &=0 - \left( -\frac{1}{5} + \frac{2}{4} - \frac{1}{3} \right) = \frac{1}{5} - \frac{2}{4} + \frac{1}{3} \\ \int_{-1}^{0} (y^2+y)(y)(y+1) \, dy &= \frac{1}{30} \\ E(XY) &= \frac{1}{15} \\ \rho &= \frac{ \left( \frac{1}{15} \right) }{ \left( \frac{ \sqrt{3} }{3} \right) \left( \frac{ \sqrt{3} } {6} \right) } = \frac{ \frac{1}{15} } { \frac{3}{18} } \\ \rho &= \frac{2}{5} \end{align*}

$\endgroup$
  • 1
    $\begingroup$ In the calculation of $E(Y)$ and $E(XY)$, you haven't added the value of the integral from 0 to 1. $\endgroup$ – Narendra Dec 8 '19 at 15:04
  • $\begingroup$ @NarendraDeconda Since $Y$ is symmetric about the y-axis, I clam that $E(Y) = 0$. Now, for $E(XY)$. It is also symmetric about the y-axis and greater than $0$ except when $X = 0$. That is why I can only consider the left half and multiply by $2$. $\endgroup$ – Bob Dec 8 '19 at 15:16
  • $\begingroup$ I am not sure of the procedure used for calculating $E(XY)$. If the joint density function is known, then I would calculate as $E(XY) = \int \int xy f(x,y) dxdy$. $\endgroup$ – Narendra Dec 8 '19 at 15:25
  • $\begingroup$ @Narendra In this case, $X$ and $Y$ are dependent on each other. That is, we only have a single independent random variable. Therefore, I believe your formula does not apply. $\endgroup$ – Bob Dec 8 '19 at 17:16
  • $\begingroup$ @Bob The formula does apply. What is NOT true, if $X$ and $Y$ are not independente, is that $f(x,y)=f_X(x)f_Y(y)$, i.e., the joint density is not the product of the individual densities. $\endgroup$ – Célio Augusto Dec 8 '19 at 17:41
1
+50
$\begingroup$

For $E[XY]$, if I understood correctly, there is a mistake. You are first choosing $X$ and than $Y=h(X)$, with $h$ deterministic. So you have to evaluate:

$E[XY]=\int f_X(x) xh(x)dx$

Instead it looks that you integrated over $y$. These would correspnd to the situation where you first choose $Y$ and than $X$ accordingly. But consider than that when $h$ is invertible:

$\int f_X(x) xh(x)dx \ne \int f_Y(y) h^{-1}(y)ydy$ [0]

An identity clearly cannot be generally true since the left member is independent of the density of $Y$ , $f_Y$.

UPDATE: Actually it is a nice result that that, for the particular $h$ chosen in this problem, which depends on the c.d.f. of the distributions, the situation is symmetric and the method of the OP should be correct (even if maybe the OP did not do it on purpose?). Let's try to show this:

Denoting with $F_X$ the c.f.d. we have that:

$E[XY]=E[XF^{-1}_Y[F_X(X)]]=\int dx f_X(x) x F^{-1}_Y[F_X(x)]$ [1]

Let me know if [1] is not clear. Changing variables $F_X(x)=z$ we have that (remember that the derivative of the c.d.f. is equal to the p.d.f.):

$E[XY]=\int F_X^{-1}(z)F_Y^{-1}(z)dz$ [2]

This shows the symmetric role of $X$ and $Y$ in this particular setting where [0] holds as an equality. This means that [0] holds for the particular $h$ of this problem as an equality and that the method of the OP must give the right result. (NB: expression [2] is purely theoretical and I will not use it in this post)

I think at the moment therefore that the OP merely forgot a factor of 2 in his calculations. In the specific problem the left member of [0] becomes:

$\int f_X(x) xh(x)dx = 1/2\times2 \times\int_{-1}^0 x(\sqrt{1-x}-1)dx$

and the right member:

$\int f_Y(y) h^{-1}(y)ydy=2\int_{-1}^0 y(y^2+2y)(y+1) dy$

and both expressions equal $E[XY]=7/30$, as Wolfram alpha can easily verify:

https://www.wolframalpha.com/input/?i=int_%7B-1%7D%5E0+x+%28%5Csqrt%281%2Bx%29-1%29

and

https://www.wolframalpha.com/input/?i=2*int_%7B-1%7D%5E0+y%28y%5E2%2B2y%29%28y%2B1%29

Note that the second integral is almost equal to the one used by the OP but differs from that by a factor of 2 in $y^2+2y$.

I have to say that similar problematics affect the calculation of the variance of $Y$ from the OP calculations... In that case I think the situation is not symmetric and an identity like [0] does not hold for the variance of $Y$...

$\endgroup$
  • $\begingroup$ I am following what you are saying. I suspect that the problem is that my calculations of $E(XY)$ is wrong. However, I am having trouble understanding what you wrote. Could you setup the correct integral for $E(XY)$? $\endgroup$ – Bob Dec 10 '19 at 18:49
  • $\begingroup$ Maybe trying to follow my update clarifies something ? $\endgroup$ – Thomas Dec 11 '19 at 8:10
  • $\begingroup$ I think that if you try to get what is $h$ in the problem than everything will be clear. $\endgroup$ – Thomas Dec 11 '19 at 8:17
  • $\begingroup$ I added with my update some properties that are not strictly required by the problem but that I found interesting. I hope that my answer gives you anyway enough hints for the particular problem and I also added the explicit form of the integrals as you asked.... $\endgroup$ – Thomas Dec 11 '19 at 12:03
  • $\begingroup$ To find $E[XY]$, I claim that it is valid to treat ether $X$ or $Y$ as the independent variable.Therefore, I can integrate over $Y$ instead of $X$. if $E[XY] = \frac{7}{30}$ then we are getting $\rho > 1$. Is there a mistake else where? $\endgroup$ – Bob Dec 11 '19 at 18:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.