5.3 Calculation of Correlation Coefficient
The correlation coefficient will be in the interval \([-1,1]\).
5.3.1 Pearson Product-Moment Correlation Coefficient
\begin {align*} \text {(a).}\hspace {1cm} r&=\frac {\sum (X-\overline {X})(Y-\overline {Y})}{\sqrt {\sum (X-\overline {X})^2}\hspace {0.1cm}.\hspace {0.1cm}\sqrt {\sum (Y-\overline {Y})^2}}\\\\\\ \text {(b).}\hspace {1cm} r&=\frac {n\sum XY-\sum X\sum Y}{\sqrt {n\sum X^2-\Bigg (\sum X\Bigg )^2}\sqrt {n\sum Y^2-\Bigg (\sum Y\Bigg )^2}}\\ \end {align*}
Example 5.3. Compute the product-moment correlation coefficient for the examination marks used in the scatter diagram above.
Solution. Build the three extra columns and total everything.
| \(X\) | \(Y\) | \(XY\) | \(X^2\) | \(Y^2\) |
| 42 | 31 | 1302 | 1764 | 961 |
| 84 | 83 | 6972 | 7056 | 6889 |
| 50 | 42 | 2100 | 2500 | 1764 |
| 42 | 60 | 2520 | 1764 | 3600 |
| 33 | 28 | 924 | 1089 | 784 |
| 50 | 63 | 3150 | 2500 | 3969 |
| 69 | 59 | 4071 | 4761 | 3481 |
| 81 | 92 | 7452 | 6561 | 8464 |
| 80 | 73 | 5840 | 6400 | 5329 |
| 35 | 40 | 1400 | 1225 | 1600 |
| 566 | 571 | 35731 | 35620 | 36841 |
\[r=\frac {n\sum XY-\sum X\sum Y} {\sqrt {n\sum X^2-\left (\sum X\right )^2}\ \sqrt {n\sum Y^2-\left (\sum Y\right )^2}} =\frac {10(35731)-566(571)}{\sqrt {10(35620)-566^2}\ \sqrt {10(36841)-571^2}}=0.876.\] It is convenient to record the three quantities that every later formula needs: \[S_{XX}=3584.4,\qquad S_{YY}=4236.9,\qquad S_{XY}=3412.4,\] so that \(r=S_{XY}/\sqrt {S_{XX}S_{YY}}\) and, below, \(\hat {b}=S_{XY}/S_{XX}\).
5.3.2 Spearman’s Rank Correlation Coefficient
In this case we do not have two continuous variables which are normally distributed but two discrete
variables in the form of ranking
\[r=1-\frac {6\sum d^2}{n(n^2-1)}\]
If there is an agreement between the two ranks, then \(r=1\). \(d=\) difference between the two ranks.
Example 5.4. Two judges at a competition awarded the following marks to candidates
| Judge A | 5.8 | 5.5 | 5.9 | 4.9 | 5.9 | 5.6 | 5.0 |
| Judge B | 5.5 | 5.4 | 5.8 | 5.3 | 5.7 | 5.7 | 5.7 |
- 1.
- Calculate the Spearmans rank correlation coefficient.
- 2.
- Do the judges agree on the order in which they place the candidate.
Solution.
| Judge A | Rank | Judge B | Rank | \(d\) | \(d^2\) |
| 5.8 | 3 | 5.5 | 5 | \(-2\) | 4 |
| 5.5 | 5 | 5.4 | 6 | \(-1\) | 1 |
| 5.9 | 3/2 | 5.8 | 1 | 0.5 | 0.25 |
| 4.9 | 7 | 5.3 | 7 | 0 | 0 |
| 5.9 | 3/2 | 5.7 | 3 | \(-1.5\) | 2.25 |
| 5.6 | 4 | 5.7 | 3 | 1 | 1 |
| 5.0 | 6 | 5.7 | 3 | 3 | 9 |
| 17.5 |
\begin {align*} r&=1-\frac {6\sum d^2}{n(n^2-1)}=1-\frac {6\times 17.5}{7(7^2-1)}\\\\ \implies \hspace {0.5cm} r&=0.6875 \end {align*}
There is a positive fair correlation between the judges. So we have that \(r_s=0.6875\)
Now we solve for the second part.
Set the hypothesis
\(H_0\): The is no correlation between the judges \(r_s=0\)
\(H_1:\) There is an association \(r_s\neq 0\)
\(|r_c|=\) critical value from the table, \(n=7\), \(|r_c|=0.75\)
\[r_s=0.6875\]
Since \(r_s = 0.6875 < |r_c| = 0.75\), we fail to reject \(H_0\) at this level.
Be careful how that is reported. It does not show the judges disagree. The observed \(r_s = 0.6875\) is a fairly
strong positive association – it is simply not strong enough, with only 7 items, to rule out
chance at this significance level. A test on so few observations has little power, and the
honest conclusion is that there is insufficient evidence of agreement, not evidence of its
absence.
Questions on this section
Stuck on something here? Ask below and it stays attached to this topic.