Solving for the Regression Line

Solving for the Regression Line (r, Sy, Sx Method)

Given a bunch of data coordinates (X,Y), we can generate a scatterplot. Then, we determine the best-fit line to represent the relationship between two quantitative variables: the explanatory variable X and the response variable Y.
y^=bo+b1x
The slope b1, tells us how much y changes for every one unit increase in x.
Let’s prove this using calculus:
dxdy^=b1
“A unit increase in x will change y by b1.”
The intercept bo, tells us the value of y when x=0. It is the point where the line crosses the y-axis.


Example: Solving for the Regression Line (r, Sy, Sx Method)
We want to see if there is a relationship between the number of hours a student studies the day before the exam and the exam grade. We randomly sample 34 students:

The explanatory variable (X) is: ________
The response variable (Y) is: ________
Scatterplot

We see a positive correlation. In fact, r=0.54.
This means that there is a weak, positive correlation between hours studied and exam grade.
What does r2 tell us?
r2=(0.54)2=0.2916
About 29% of exam grade is explained by how many hours you study.
Portions of information contained in this publication/book are printed with permission of Minitab, LLC. All such material remains the exclusive property and copyright of Minitab, LLC. All rights reserved.
Suppose you are given r, sx, sy, x, y:
x=7.794, y=77.824, sx=3.906, sy=18.235, r=0.54
Step 1: Find the slope
b1=r(sxsy)
b1=0.54(3.90618.235) =2.52
Step 2: Find the intercept
bo=y−b1x
bo=77.824−(2.52)(7.794)=58.18
Step 3: Show the full linear equation
y^=bo+b1x
y^=58.18+2.52x

Solving for the Regression Line (Least Squares Method)

Given a bunch of data coordinates (X,Y), we can generate a scatterplot. Then, we determine the best-fit line to represent the relationship between two quantitative variables: the explanatory variable X and the response variable Y.
y^=bo+b1x
The slope b1, tells us how much y changes for every one unit increase in x.
Let’s prove this using calculus:
dxdy^=b1
“A unit increase in x will change y by b1.”
The intercept bo, tells us the value of y when x=0. It is the point where the line crosses the y-axis.


Example: Solving for the Regression Line (Sxy, Sxx Method)
We want to see if there is a relationship between the number of hours a student studies the day before the exam (X) and the exam grade (Y). We randomly sample 34 students:
Note: raw data has been truncated

n=34
Important: (∑xi)(∑yi)=∑xiyi
Scatterplot

Portions of information contained in this publication/book are printed with permission of Minitab, LLC. All such material remains the exclusive property and copyright of Minitab, LLC. All rights reserved.

Step 1: Find the slope
b1=SSxxSSxy
SSxy=∑xiyi−n(∑xi)(∑yi)
SSxy=21,892−34(265)(2,646)=1,268.76
SSxx=∑xi2−n(∑xi)2
SSxx=2,569−34(265)2=503.56
Therefore:
b1=SSxxSSxy=503.561,268.76=2.52
Step 2: Find the intercept
bo=y−b1x
y=n∑yi
y=342,646=77.824
x=n∑xi
x=34265=7.794
Therefore:
bo=77.824−(2.52)(7.794)=58.18
Step 3: Show the full linear equation
y^=bo+b1x
y^=58.18+2.52x
Using the information provided below, solve for the slope and intercept of the linear regression equation.
∑x=702∑y=461∑xy=19,871∑x2=31396∑y2=13,449
n=18
Click on 'HINT' if you are stuck!