Question 1196643
<font color=black size=3>
If you are in a hurry, then you can use technology to quickly compute the r and r^2 values. 
Two examples would be the <a href="https://www.mathbootcamps.com/find-the-correlation-coefficient-r-on-your-calculator-ti83-84/">LinReg</a> command on a TI83 (or similar) and using the <a href="https://support.microsoft.com/en-us/office/correl-function-995dcef7-0c0a-4bed-a3fb-239d7b68ca92">the CORREL command</a> in a spreadsheet.
There are many other options to choose from. Feel free to search out your favorite.
You should find these approximations
r = 0.9878
<font color=red>r^2 = 0.9757</font>
Since r^2 is very close to 1, this makes the linear regression a good fit. Approximately 97.57% of the variation in x explains the variation in y.



If you have more time to go over the math, then there are various ways to calculate the correlation coefficient. 
I'll go over two slightly different methods.


-------------------------------------------------------------------------------------------------------------


Method 1


x = capacity of hard drive in terabytes (TB)
y = price in dollars


Given info:
n = 9 = sample size = number of x,y pairs
xbar = 7.611
ybar = 786.49
SD(x) = 9.854
SD(y) = 1417.82


The term "xbar" refers to the horizontal bar over the x, i.e. *[tex \Large \overline{\text{x}}]
A similar story is with ybar as well.


Given Data
<table border = "1" cellpadding = "5"><tr><td>x</td><td>y</td></tr><tr><td>0.5</td><td>60.99</td></tr><tr><td>1</td><td>77.99</td></tr><tr><td>2</td><td>112.97</td></tr><tr><td>3</td><td>110.99</td></tr><tr><td>4</td><td>151.99</td></tr><tr><td>6</td><td>425.34</td></tr><tr><td>8</td><td>597.11</td></tr><tr><td>12</td><td>1081.99</td></tr><tr><td>32</td><td>4459</td></tr></table>Form a third column which is the product of the x and y columns
Eg: 0.5*60.99 = 30.495 in the first row<table border = "1" cellpadding = "5"><tr><td>x</td><td>y</td><td>xy</td></tr><tr><td>0.5</td><td>60.99</td><td>30.495</td></tr><tr><td>1</td><td>77.99</td><td>77.99</td></tr><tr><td>2</td><td>112.97</td><td>225.94</td></tr><tr><td>3</td><td>110.99</td><td>332.97</td></tr><tr><td>4</td><td>151.99</td><td>607.96</td></tr><tr><td>6</td><td>425.34</td><td>2552.04</td></tr><tr><td>8</td><td>597.11</td><td>4776.88</td></tr><tr><td>12</td><td>1081.99</td><td>12983.88</td></tr><tr><td>32</td><td>4459</td><td>142688</td></tr></table>I strongly recommend using spreadsheet software. 
It's not only fast and efficient, but also something that is expected in real world applications.
I'm using LibreOffice but you could use Excel or Google Sheets or whichever app you prefer most.


Add up the values in the xy column to get 164,276.155
Then we subtract off the value of n*xbar*ybar = 9*7.611*786.49 = 53,873.77851


So we have:
Sum(xy) - n*xbar*ybar = 164,276.155 - 53,873.77851 = 110,402.37649


We'll divide that result over the product of the given standard deviation values, multiplied with (n-1)
So,
(n-1)*SD(x)*SD(y) = (9-1)*(9.854)*(1417.82) = 111,769.58624



Therefore,
r = (110,402.37649)/(111,769.58624)
r = 0.98776760480204
r^2 = (0.98776760480204)^2
r^2 = 0.97568484109636
<font color=red>r^2 = 0.9757</font>
which is approximate.


Since r^2 is very close to 1, this makes the linear regression a good fit. Approximately 97.57% of the variation in x explains the variation in y.


Note: The formula I used just now is
*[tex \Large \text{r} = \frac{ (\sum \text{x}\text{y}) - \text{n}*\overline{\text{x}}*\overline{\text{y}}}{(\text{n}-1)*SD(\text{x})*SD(\text{y})}]


-------------------------------------------------------------------------------------------------------------


Method 2


x = capacity of hard drive in terabytes (TB)
y = price in dollars


Given info:
n = 9 = sample size = number of x,y pairs
xbar = 7.611
ybar = 786.49
SD(x) = 9.854
SD(y) = 1417.82


Given Data<table border = "1" cellpadding = "5"><tr><td>x</td><td>y</td></tr><tr><td>0.5</td><td>60.99</td></tr><tr><td>1</td><td>77.99</td></tr><tr><td>2</td><td>112.97</td></tr><tr><td>3</td><td>110.99</td></tr><tr><td>4</td><td>151.99</td></tr><tr><td>6</td><td>425.34</td></tr><tr><td>8</td><td>597.11</td></tr><tr><td>12</td><td>1081.99</td></tr><tr><td>32</td><td>4459</td></tr></table>Instead of an xy column, we'll form the Zx column
Zx = (x - xbar)/(SD(x))
We're computing the z score for each x term


For instance, in the first row we have
Zx = (x-xbar)/(SD(x))
Zx = (0.5-7.611)/(9.854)
Zx = -0.72163588390501
Zx = -0.721636
Do the same thing for each item in the x column. The values of xbar and SD(x) will remain constant.


This is what the updated table looks like<table border = "1" cellpadding = "5"><tr><td>x</td><td>y</td><td>Zx</td></tr><tr><td>0.5</td><td>60.99</td><td>-0.721636</td></tr><tr><td>1</td><td>77.99</td><td>-0.670895</td></tr><tr><td>2</td><td>112.97</td><td>-0.569413</td></tr><tr><td>3</td><td>110.99</td><td>-0.467932</td></tr><tr><td>4</td><td>151.99</td><td>-0.36645</td></tr><tr><td>6</td><td>425.34</td><td>-0.163487</td></tr><tr><td>8</td><td>597.11</td><td>0.039476</td></tr><tr><td>12</td><td>1081.99</td><td>0.445403</td></tr><tr><td>32</td><td>4459</td><td>2.475036</td></tr></table>Follow similar steps for the Zy column
For example, we'll have the following calculation for the 1st row.
Zy = (y - ybar)/(SD(y))
Zy = (60.99 - 786.49)/(1417.82)
Zy = -0.511701


We have this so far<table border = "1" cellpadding = "5"><tr><td>x</td><td>y</td><td>Zx</td><td>Zy</td></tr><tr><td>0.5</td><td>60.99</td><td>-0.721636</td><td>-0.511701</td></tr><tr><td>1</td><td>77.99</td><td>-0.670895</td><td>-0.499711</td></tr><tr><td>2</td><td>112.97</td><td>-0.569413</td><td>-0.475039</td></tr><tr><td>3</td><td>110.99</td><td>-0.467932</td><td>-0.476436</td></tr><tr><td>4</td><td>151.99</td><td>-0.36645</td><td>-0.447518</td></tr><tr><td>6</td><td>425.34</td><td>-0.163487</td><td>-0.254722</td></tr><tr><td>8</td><td>597.11</td><td>0.039476</td><td>-0.133571</td></tr><tr><td>12</td><td>1081.99</td><td>0.445403</td><td>0.208419</td></tr><tr><td>32</td><td>4459</td><td>2.475036</td><td>2.590251</td></tr></table>Then we'll multiply the Zx and Zy items for each row.
Eg: Zx*Zy = (-0.721636)*(-0.511701) = 0.369262 in row one


This is what the fully completed table looks like<table border = "1" cellpadding = "5"><tr><td>x</td><td>y</td><td>Zx</td><td>Zy</td><td>ZxZy</td></tr><tr><td>0.5</td><td>60.99</td><td>-0.721636</td><td>-0.511701</td><td>0.369262</td></tr><tr><td>1</td><td>77.99</td><td>-0.670895</td><td>-0.499711</td><td>0.335254</td></tr><tr><td>2</td><td>112.97</td><td>-0.569413</td><td>-0.475039</td><td>0.270493</td></tr><tr><td>3</td><td>110.99</td><td>-0.467932</td><td>-0.476436</td><td>0.22294</td></tr><tr><td>4</td><td>151.99</td><td>-0.36645</td><td>-0.447518</td><td>0.163993</td></tr><tr><td>6</td><td>425.34</td><td>-0.163487</td><td>-0.254722</td><td>0.041644</td></tr><tr><td>8</td><td>597.11</td><td>0.039476</td><td>-0.133571</td><td>-0.005273</td></tr><tr><td>12</td><td>1081.99</td><td>0.445403</td><td>0.208419</td><td>0.09283</td></tr><tr><td>32</td><td>4459</td><td>2.475036</td><td>2.590251</td><td>6.410964</td></tr></table>
Add up the values in the final column and you should get roughly 7.902107


So,
r = Sum(ZxZy)/(n-1)
r = 7.902107/(9-1)
r = 7.902107/8
r = 0.987763375
r^2 = (0.987763375)^2
r^2 = 0.9756764849914
r^2 = 0.9757


Since r^2 is very close to 1, this makes the linear regression a good fit. Approximately 97.57% of the variation in x explains the variation in y.


<font color=red size=4>Answer: r^2 = 0.9757 approximately</font>
</font>