# Given is $2$ dimensional random variable $(X,Y)$ with table. Determine the correlation between $X$ and $Y$

Given is a two-dimensional random variable $(X,Y)$. Here is the table of single probabilities $p_{ij}$ of $(X,Y)$ which was incomplete and I filled it with needed values so it's correct and complete.

\begin{array}{r|rrrr|r} X\setminus Y & 1 & 2 & 3 & 4 & p_i \\ \hline -1 & 0 & 0.01 & 0.09 & 0.10 & 0.2 \\ 0 & 0.6 & 0.03 & 0 & 0.07 & 0.7 \\ 1 & 0 & 0.06 & 0.01 & 0.03 & 0.1 \\ \hline p_j & 0.6 & 0.1 & 0.1 & 0.2 & 1 \\ \end{array}

Now I want calculate correlation between $X$ and $Y$ but not know how do it correctly? Because it can be asked in exam and I don't see example for it.

When I understand it correct I need find expected values of $X$ and $Y$, e.g. $E(X)$ and $E(Y)$ then

$$\mathrm{correlation}(X,Y)=E(XY) - E(X) \cdot E(Y).$$

Assuming this is correct, I still have no idea how compute these expected value from the table :(

• Do you know how to compute $E(X)$ from such a table? If so, why don't you add that to your question, clicking on "edit" beneath the question to show us how you'd do that. – John Hughes Jan 13 '18 at 14:01
• Firstly note that $\mathbb E(XY)- \mathbb E(X)\cdot \mathbb E(X)$ is the $\texttt{covariance}$, not the $\texttt{correlation}$ coefficient. The correlation coefficient is $\rho_{XY}=\frac{Cov(X,Y)}{\sigma_X\cdot \sigma_Y}$ – callculus Jan 13 '18 at 14:09
• I have tried to improve the readability of your question by introducing $\rm \LaTeX$. It is possible that I unintentionally changed the meaning of your question. Please proofread the question to ensure this has not happened. – GNUSupporter 8964民主女神 地下教會 Jan 13 '18 at 14:09
• @GNUSupporter Thank you it look great I didn't know how do it in latex!!! – roblind Jan 13 '18 at 15:12

We know that $$E(X) = \sum xp(x) = - 0.2+0+0.1=-0.1$$ $$E(X^2) = 0.2+0+0.1=0.3$$ $$E(Y)= \sum yp(y) = 0.6+0.2+0.3+0.8=1.9$$ $$E(Y^2) = 0.6+0.4+0.9+3.2=5.1$$ $$E(XY) = \sum xyp(x, y) = - 0.18$$ Hence, $$\operatorname{Cov} (X, Y) = E(XY) - E(X) E(Y) = 0.01$$ $$\sigma_x^2 = E(X^2)-[E(X)]^2 = 0.29$$ $$\sigma_y^2 = E(Y^2)-[E(Y)]^2 = 1.49$$ Therefore, $$r_{XY} = \frac{0.01}{\sqrt{1.49\times 0.29}} = 0.015$$