This page uses two small problems to practise correlation, coefficient of determination, regression equation, prediction and interpretation.
We use the direct formula method based on the least squares idea. The fitted line predicts \(Y\) from \(X\).
\[ r=\frac{n\sum XY-\sum X\sum Y} {\sqrt{\left[n\sum X^2-(\sum X)^2\right]\left[n\sum Y^2-(\sum Y)^2\right]}} \]
\[ \text{Coefficient of Determination}=r^2\times100\% \]
\[ b=\frac{n\sum XY-\sum X\sum Y}{n\sum X^2-(\sum X)^2} \]
\[ a=\bar{Y}-b\bar{X} \]
\[ \hat{Y}=a+bX \]
Equivalently, after finding \(b\), write
\[ Y-\bar{Y}=b(X-\bar{X}) \]
and simplify. Both forms give the same regression line.
The following data show study hours \(X\) and exam marks \(Y\) of five students. Find \(r\), coefficient of determination, regression equation of marks on study hours, and predict marks when \(X=7\) hours.
| Study Hours \(X\) | 2 | 3 | 5 | 6 | 8 |
|---|---|---|---|---|---|
| Exam Marks \(Y\) | 50 | 55 | 65 | 70 | 82 |
First find the required sums, then calculate \(r\), \(b\), \(a\) and \(\hat{Y}\).
First calculate the required sums:
| \(n\) | \(\sum X\) | \(\sum Y\) | \(\sum X^2\) | \(\sum Y^2\) | \(\sum XY\) |
|---|---|---|---|---|---|
| 5 | 24 | 322 | 138 | 21374 | 1666 |
Calculate Karl Pearson’s correlation coefficient:
\[ r=\frac{n\sum XY-\sum X\sum Y} {\sqrt{\left[n\sum X^2-(\sum X)^2\right]\left[n\sum Y^2-(\sum Y)^2\right]}} \]
\[ r=\frac{5(1666)-24(322)} {\sqrt{\left[5(138)-24^2\right]\left[5(21374)-322^2\right]}} \]
\[ r=0.999 \]
Coefficient of determination:
\[ r^2\times100\%=(0.999)^2\times100\%=99.78\% \]
About \(99.78\%\) of the variation in exam marks is explained by study hours according to this linear model.
Now calculate the regression coefficient \(b\):
\[ b=\frac{n\sum XY-\sum X\sum Y}{n\sum X^2-(\sum X)^2} \]
\[ b=\frac{5(1666)-24(322)}{5(138)-24^2} \]
\[ b=5.281 \]
Here,
\[ \bar{X}=\frac{24}{5}=4.8,\qquad \bar{Y}=\frac{322}{5}=64.4 \]
Using \(a=\bar{Y}-b\bar{X}\):
\[ a=64.4-5.281(4.8) \]
\[ a=39.053 \]
So the regression equation is:
\[ \hat{Y}=39.053+5.281X \]
The same regression line can also be written directly as:
\[ Y-\bar{Y}=b(X-\bar{X}) \]
\[ Y-64.4=5.281(X-4.8) \]
Simplifying,
\[ \hat{Y}=39.053+5.281X \]
When \(X=7\),
\[ \hat{Y}=39.053+5.281(7) \]
\[ \hat{Y}=76.02 \]
A simply supported beam carries different loads \(X\) at its midpoint. The corresponding maximum deflection \(Y\) is recorded below. Find \(r\), coefficient of determination, regression equation of deflection on load, and estimate deflection when \(X=170\) kg.
| Load \(X\) kg | 100 | 120 | 140 | 160 | 180 | 200 |
|---|---|---|---|---|---|---|
| Deflection \(Y\) cm | 0.45 | 0.55 | 0.60 | 0.70 | 0.80 | 0.85 |
Find \(r\), \(r^2\times100\%\), \(b\), \(a\), then substitute \(X=170\).
First calculate the required sums:
| \(n\) | \(\sum X\) | \(\sum Y\) | \(\sum X^2\) | \(\sum Y^2\) | \(\sum XY\) |
|---|---|---|---|---|---|
| 6 | 900 | 3.95 | 142000 | 2.7175 | 621 |
Calculate Karl Pearson’s correlation coefficient:
\[ r=\frac{6(621)-900(3.95)} {\sqrt{\left[6(142000)-900^2\right]\left[6(2.7175)-(3.95)^2\right]}} \]
\[ r=0.996 \]
Coefficient of determination:
\[ r^2\times100\%=(0.996)^2\times100\%=99.11\% \]
About \(99.11\%\) of the variation in deflection is explained by load according to this linear model.
Calculate \(b\):
\[ b=\frac{6(621)-900(3.95)}{6(142000)-900^2} \]
\[ b=0.004071 \]
Here,
\[ \bar{X}=\frac{900}{6}=150,\qquad \bar{Y}=\frac{3.95}{6}=0.6583 \]
Using \(a=\bar{Y}-b\bar{X}\):
\[ a=0.6583-0.004071(150) \]
\[ a=0.0476 \]
So the regression equation is:
\[ \hat{Y}=0.0476+0.004071X \]
The same regression line can also be written directly as:
\[ Y-\bar{Y}=b(X-\bar{X}) \]
\[ Y-0.6583=0.004071(X-150) \]
Simplifying,
\[ \hat{Y}=0.0476+0.004071X \]
When \(X=170\),
\[ \hat{Y}=0.0476+0.004071(170) \]
\[ \hat{Y}=0.740 \]