12.4 Simple Linear Regression
A linear regression is a straight line that describes how the values of a response variable change as the predictor variable changes. The equation of a line, relating to uses the slope-intercept form of a line, but with different letters than what you may be used to in a math class. We let represent the sample -intercept (the value of when ), the sample slope (rise over run), and the predicted value of for a specific value of . The equation is written as .
Some textbooks and the TI calculators use the letter to represent the -intercept and to represent the slope, and the equation is written as . These letters are just symbols representing the placeholders for the numeric values for the -intercept and slope.
If we were to fit the best line that was closest to all the points on the scatterplot we would get what we call the “line of best fit,” also known as the “regression equation” or “least squares regression line.” Figure 12-9 is a scatterplot with just five points.

Figure 12-10 shows the least-squares regression line of on , which is the line that minimizes the squared vertical distance from all of the data. If we were to fit the line that best fits through the points, we would get the line pictured below.

What we want to look for is the minimum of the squared vertical distance between each point and the regression equation, called a residual. This is where the name of the least squares regression line comes from. Figure 12-11 shows the squared residuals.

To find the slope and -intercept for the equation of the least-squares regression line we use the following formulas: slope , -intercept: .
To compute the least squares regression line, you will need to first find the slope. Then substitute the slope into the following equation of the -intercept: , where = the sample mean of the ’s and = the sample mean of the ’s.
Once we find the equation for the regression line, we can use it to estimate the response variable for a specific value of the predictor variable .
Note: we would only want to use the regression equation for prediction if we reject and find that there is a significant correlation between and . Alternatively, we could start with the regression equation and then test to see if the slope is significantly different from zero.
Adapted from Mostly Harmless Statistics by Rachel Webb (Portland State University), hosted on LibreTexts (stats.libretexts.org) and licensed under CC BY-SA 4.0. Changes were made. License: CC-BY-SA-4.0.