2
$\begingroup$

Say I have the following sample from a continuous variable $X$ and a categorical (dichotomous) variable $Y$:

  X Y
0.5 1
2.3 2
2.2 2
1.8 1

Moreover, the covariance matrix between $X$ and $Y$ is also known:

$$ \Sigma_{XY} = \begin{pmatrix} \sigma_{XX} & \sigma_{XY} \\ \sigma_{YX} & \sigma_{YY} \end{pmatrix} = \begin{pmatrix} 0.5 & 1.2 \\ 1.2 & 0.4 \end{pmatrix} $$

Now let's say we have dummy-coded $Y$, so our data looks like this:

  X Y1 Y2
0.5  1  0
2.3  0  1
2.2  0  1
1.8  1  0

My question is: how can we calculate the covariance matrix between $X$, $Y_1$ and $Y_2$?

$$ \Sigma_{XY_1Y_2} = \begin{pmatrix} \sigma_{XX} & \sigma_{XY_1} & \sigma_{XY_2} \\ \sigma_{Y_1X} & \sigma_{Y_1Y_1} & \sigma_{Y_1Y_2} \\ \sigma_{Y_2X} & \sigma_{Y_2Y_1} & \sigma_{Y_2Y_2} \end{pmatrix} = \begin{pmatrix} 0.5 & ? & ? \\ ? & ? & ? \\ ? & ? & ? \end{pmatrix} $$

In my actual problem, I can often bootstrap my way into getting a fair estimate for this matrix, but it is very important for me to find the analytical solution as well. For what it's worth, the proportion of each category in the population is also known.

$\endgroup$
1
$\begingroup$

We've got:

$$Y_1 = 1 - Y_2 \;\;(1)$$ $$Y = Y_2 + 1 \;\;(2)$$ $$Y = 2 - Y_1 \;\;(3)$$

So, using equation $(1)$: $$\sigma_{Y_1Y_1} = Var(Y_1) = 0 + (-1)^2 Var(Y_2) = \sigma_{Y_2Y_2}$$ $$\sigma_{Y_1Y_2} = \sigma_{Y_2Y_1} = Cov(Y_1, Y_2) = -Cov(Y_1, Y_1) = -\sigma_{Y_1Y_1}$$

... and using equations (2, 3):

$$Var(Y) = 0.4 = Var(Y_2) = Var(Y_1)$$

As for the other two $\sigma$s, assuming that the covariance $\sigma_{XY}$ was calculated using their numerical values :

$$\sigma_{XY} = Cov(X, Y) = E((X - E(X))(Y - E(Y))) = 1.2$$ $$= E((X-E(X))(Y_2 + 1 - 1 - E(Y_2))) = \sigma_{XY_2}$$

Similarly:

$$\sigma_{XY} = E((X-E(X))(2 - Y_1 - 2 + E(Y_1))) = -\sigma_{XY_1}$$

So the final answer is:

$$\Sigma_{XY} = \begin{pmatrix} 0.5 & -1.2 & 1.2 \\ -1.2 & 0.4 & -0.4 \\ 1.2 & -0.4 & 0.4 \end{pmatrix}$$

... and that should finish the answer if I've not made any errors!

$\endgroup$
2
  • $\begingroup$ Thank you for that, I'll try to reproduce it in my example (and hopefully properly expand to the polytomous case). As for your last remark, correlations involving a continuous and a dichotomous variable are commonly calculated using point-biserial correlation. I am assuming a properly-calculated $\Sigma_{XY}$ could be derived from that, but that's something I'll check later. $\endgroup$ Oct 12 '18 at 12:05
  • $\begingroup$ Thanks for the example. Btw, I've made an edit, removing my unreasonable and unneeded $Bernoulli$ assumption. $\endgroup$
    – adityar
    Oct 12 '18 at 12:40

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.