Linear Regression Problem for correlation coefficient (r)
The given data sample size = n = 12
Formulae -
$$ Linear\ Correlation\ Coefficient = r = \frac {S_{XY}}{\sqrt {S_{XX} \times S_{YY}}} $$
Where,
$$ S_{XY} = \Bigl(\sum xy\Bigr) - n. \overline x. \overline y $$
$$ S_{XX} = \Bigl(\sum x^2 \Bigr) - n. \overline x^2 $$
$$ S_{YY} = \Bigl(\sum y^2\Bigr) - n. \overline y^2 $$
Step 1
Calculate the $ \sum x$, $\sum y$, $\sum x^2$, $\sum y^2$, and $ \sum xy$
x |
y |
x2 |
y2 |
xy |
4 |
73 |
16 |
5329 |
292 |
4 |
57 |
16 |
3249 |
228 |
7 |
81 |
49 |
6561 |
567 |
8 |
94 |
64 |
8836 |
752 |
12 |
110 |
144 |
12100 |
1320 |
15 |
124 |
225 |
15376 |
1860 |
16 |
134 |
256 |
17956 |
2144 |
17 |
139 |
289 |
19321 |
2363 |
14 |
124 |
196 |
15376 |
1736 |
11 |
103 |
121 |
10609 |
1133 |
7 |
81 |
49 |
6561 |
567 |
5 |
80 |
25 |
6400 |
400 |
120 |
1200 |
1450 |
127674 |
13362 |
Step 2
Calculate the sample means of temperature (x) and ice cream sales (y) as follows:
$$ \overline x = \frac {\sum x}{n} = \frac {120}{12} = 10 $$
$$ \overline y = \frac {\sum y}{n} = \frac {1200}{12} = 100 $$
Step 3
Calculate the $S_{XY}$
$$ S_{XY} = \Bigl(\sum xy\Bigr) - n. \overline x. \overline y $$
$$ S_{XY} = 13362 - 12 \times 10 \times 100 $$
$$ S_{XY} = 13362 - 12000 $$
$$ S_{XY} = 1362 $$
Calculate the $S_{XX}$
$$ S_{XY} = 1362 $$
$$ S_{XX} = \Bigl(\sum x^2 \Bigr) - n. \overline x^2 $$
$$ S_{XX} = 1450 - 12 \times (10)^2 $$
$$ S_{XX} = 1450 - 1200 $$
$$ S_{XX} = 250 $$
Calculate the $S_{YY}$
$$ S_{YY} = \Bigl(\sum y^2\Bigr) - n. \overline y^2 $$
$$ S_{YY} = 127674 - 12 \times (100)^2 $$
$$ S_{YY} = 127674 - 120000 $$
$$ S_{YY} = 7674 $$
Step 4
Finally, calculate the Linear Correlation Coefficient (r)
$$ r = \frac {S_{XY}}{\sqrt {S_{XX} \times S_{YY}}} $$
$$ r = \frac {1362}{\sqrt {250 \times 7674}} $$
$$ r = \frac {1362}{1385.099274} $$
$$ r = 0.983 $$
Step 5
Thus we get the Linear Correlation Coefficient r = 0.983
This implies that there is a strong, POSITIVE linear relationship between average temperature and ice cream sales since the linear correlation coefficient (r) is very close to +1.