The general formula for the least-squares regression is:
[tex]y=a+bx_i[/tex]
Where
a represents the y-intercept
b represents the slope
To estimate the y-intercept and the slope of the regression line you have to apply the following formulas:
[tex]b=\frac{\Sigma xy-\frac{\Sigma x\Sigma y}{n}}{\lbrack\Sigma x^2-\frac{(\Sigma x)^2}{n}\rbrack}[/tex][tex]a=\bar{y}-b\bar{x}[/tex]
First, calculate the sums and the means for both variables.
X= screen size
Y= price
n=7
[tex]\begin{gathered} \Sigma x=60+55+50+47+42+39+32 \\ \Sigma x=325 \end{gathered}[/tex][tex]\begin{gathered} \Sigma x^2=60^2+55^2+50^2+47^2+42^2+39^2+32^2 \\ \Sigma x^2=15643 \end{gathered}[/tex][tex]\begin{gathered} \bar{x}=\frac{\Sigma x}{n} \\ \bar{x}=\frac{325}{7} \\ \bar{x}=46.43 \end{gathered}[/tex][tex]\begin{gathered} \Sigma y=1000+800+700+600+430+400+300 \\ \Sigma y=4230 \end{gathered}[/tex][tex]\begin{gathered} \bar{y}=\frac{\Sigma y}{n} \\ \bar{y}=\frac{4230}{7} \\ \bar{y}=604.29 \end{gathered}[/tex][tex]\begin{gathered} \Sigma xy=60\cdot1000+55\cdot800+50\cdot700+47\cdot600+42\cdot430+39\cdot400+32\cdot300 \\ \Sigma xy=210460 \end{gathered}[/tex]
Calculate the slope of the line:
[tex]\begin{gathered} b=\frac{\Sigma xy-\frac{\Sigma x\Sigma y}{n}}{\Sigma x^2-\frac{(\Sigma x)^2}{n}} \\ b=\frac{210460-\frac{325\cdot4230}{7}}{15643-\frac{325^2}{7}} \\ b=\frac{210460-196392.85}{15643-15089.29} \\ b=\frac{14067.75}{553.71} \\ b=25.41 \end{gathered}[/tex]
Once you have calculated the slope, you can calculate the y-intercept:
[tex]\begin{gathered} a=\bar{y}-b\bar{x} \\ a=604.29-25.41\cdot46.43 \\ a=604.29-1179.7863 \\ a=-575.23 \end{gathered}[/tex]
The regression line for the price with respect to the screen size is:
[tex]y=-575.23+25.41x[/tex]