How to Write a Linear Regression Equation

Linear graphs plot equations visually.
••• Jupiterimages/Goodshoot/Getty Images

A linear regression equation models the general line of the data to show the relationship between the x and y variables. Many points of the actual data will not be on the line. Outliers are points that are very far away from the general data and are typically ignored when calculating the linear regression equation. It is possible to find the linear regression equation by drawing a best-fit line and then calculating the equation for that line.

    Plot the points. Draw a graph of the points in the given set.

    Draw a line that best fits the data. Look at the data and decide if it is ascending or descending overall, then place a line closest to the most points. For example, given the points {(2,3) (5,7) (1,2) (4,8)}, the linear regression equation will be ascending, or in other words, the points will be generally going up from the left to right on the graph.

    Calculate the equation of the line. Pick two points on the line to calculate the slope with and note the y-intercept. On the best-fit line for the points {(2,3) (5,7) (1,2) (4,8)}, one point is (0.5,1.25) and another is the y-intercept (0,0.5). Use the formula for the slope of a line, m = (y2 - y1)/(x2 - x1), to find the slope. By plugging in the point values, m = (0.5 - 1.25)/(0 - 0.5) = 1.5. So with the y-intercept and the slope, the linear regression equation can be written as y = 1.5x + 0.5.