Correlation

In dealing with two random variables, we refer to the measure of their linear correlation as the correlation coefficient. When two random variables are independent, this measure is 0. If two random variables X and Y are linearly related in the sense Y = a + bX for some constants a and b, then the coefficient of correlation reaches one of the extreme values +1 or -1. In either of these cases, X and Y are referred to as perfectly correlated. The formula for the coefficient of correlation for two random variables is

ρ = ρ$\displaystyle \left(\vphantom{ X,Y}\right.$X, Y$\displaystyle \left.\vphantom{ X,Y}\right)$ = $\displaystyle {\frac{{\limfunc{Cov}\left( X,Y\right) }}{{\sigma _{x}\sigma _{y}}}}$ = $\displaystyle {\frac{{\sigma
_{xy}}}{{\sigma _{x}\sigma _{y}}}}$

where σx and σy are the standard deviations of the two random variables.

To compute the coefficient of correlation between two samples, enter the data as two columns of a matrix and, from the Statistics submenu choose Correlation. You can apply this operation to any size matrix to get the coefficient of correlation for each pair of columns: The number in the i, j position is the coefficient of correlation between column i and column j. A correlation matrix is always symmetric, with ones on the main diagonal.

$\blacktriangleright$ Statistics + Correlation

$\left[\vphantom{
\begin{array}{rr}
43 & -62 \\
77 & 66 \\
54 & -5 \\
99 & -61
\end{array}
}\right.$$\begin{array}{rr}
43 & -62 \\
77 & 66 \\
54 & -5 \\
99 & -61
\end{array}$$\left.\vphantom{
\begin{array}{rr}
43 & -62 \\
77 & 66 \\
54 & -5 \\
99 & -61
\end{array}
}\right]$, Correlation matrix: $\left[\vphantom{
\begin{array}{cc}
1.0 & 7.4831\times 10^{-2} \\
7.4831\times 10^{-2} & 1.0
\end{array}
}\right.$$\begin{array}{cc}
1.0 & 7.4831\times 10^{-2} \\
7.4831\times 10^{-2} & 1.0
\end{array}$$\left.\vphantom{
\begin{array}{cc}
1.0 & 7.4831\times 10^{-2} \\
7.4831\times 10^{-2} & 1.0
\end{array}
}\right]$


$\left[\vphantom{
\begin{array}{rrr}
-50 & -12 & -18 \\
31 & -26 & -62 \\
1 & -47 & -91
\end{array}
}\right.$$\begin{array}{rrr}
-50 & -12 & -18 \\
31 & -26 & -62 \\
1 & -47 & -91
\end{array}$$\left.\vphantom{
\begin{array}{rrr}
-50 & -12 & -18 \\
31 & -26 & -62 \\
1 & -47 & -91
\end{array}
}\right]$, Correlation matrix: $\left[\vphantom{
\begin{array}{ccc}
1.0 & -.52883 & -.71054 \\
-.52883 & 1.0 & .97297 \\
-.71054 & .97297 & 1.0
\end{array}
}\right.$$\begin{array}{ccc}
1.0 & -.52883 & -.71054 \\
-.52883 & 1.0 & .97297 \\
-.71054 & .97297 & 1.0
\end{array}$$\left.\vphantom{
\begin{array}{ccc}
1.0 & -.52883 & -.71054 \\
-.52883 & 1.0 & .97297 \\
-.71054 & .97297 & 1.0
\end{array}
}\right]$

The relationship ${\frac{{\limfunc{Cov}\left( X,Y\right) }}{{\sigma _x\sigma _y}}}$ = ρ$\left(\vphantom{
X,Y}\right.$X, Y$\left.\vphantom{
X,Y}\right)$ among correlation, covariance, and the standard deviations is illustrated in the following example.

$\left[\vphantom{
\begin{array}{rr}
-50 & -12 \\
31 & -26 \\
1 & -47
\end{array}
}\right.$$\begin{array}{rr}
-50 & -12 \\
31 & -26 \\
1 & -47
\end{array}$$\left.\vphantom{
\begin{array}{rr}
-50 & -12 \\
31 & -26 \\
1 & -47
\end{array}
}\right]$, $\left\{\vphantom{
\begin{array}{l}
\text{Correlation matrix: }\,\left[
\be...
...\\
\qquad \dfrac{-381.5}{40.951\times 17.616}=-.52884
\end{array}
}\right.$$\begin{array}{l}
\text{Correlation matrix: }\,\left[
\begin{array}{ll}
1.0 ...
...pace{0pt} \\
\qquad \dfrac{-381.5}{40.951\times 17.616}=-.52884
\end{array}$