27 Apr, 2016
Quiz 4 - Correlation
This is how you compute the correlation $r$ of two variables $x$ and $y$.
- First, compute the [averages and SD’s] for $x$ and $y$.
| |
$x$ |
$y$ |
| average |
2 |
2 |
| SD |
$\sqrt\frac{2}{3}$ |
$\sqrt\frac{2}{3}$ |
| |
|
|
- Then, [standardize] $x$ and $y$
| $z_x$ |
$z_y$ |
| $\frac{1-2}{\sqrt\frac{2}{3}} = -\sqrt\frac{3}{2}$ |
$\frac{3-2}{\sqrt\frac{2}{3}} = \sqrt\frac{3}{2}$ |
| 0 |
0 |
| $\frac{3-2}{\sqrt\frac{2}{3}} = \sqrt\frac{3}{2}$ |
$\frac{1-2}{\sqrt\frac{2}{3}} = -\sqrt\frac{3}{2}$ |
- Finall, multiple across the columns, add through the rows, and divide by the number of observations $n$
\[\begin{array}{rcl}
r &=& \ds\frac{\p{-\sqrt\frac{3}{2}}\p{\sqrt\frac{3}{2}} + (0)(0) + \p{\sqrt\frac{3}{2}}\p{-\sqrt\frac{3}{2}}}{3} \\
&=& \ds\frac{ -\frac{3}{2} + 0 -\frac{3}{2} }{3} \\
&=& \ds\frac{-3}{3} \\
&=& \mathbf{-1} \\
\end{array}\]
Therefore, the correlation between $x$ and $y$ is -1.
Notes: