Skip to main content
Statistics LibreTexts

3: Linear Regression

  • Page ID
  • Quick review of equations for lines:

    Recall the equation of a line is usually in the form \(y = mx + b\), where \(x\) and \(y\) are variables and m and b are numbers. Some basic facts about lines:

    • If you are given a number for x, you can plug it in to the equation \(y=mx+b\) to get a number for \(y\), which together give you a point with coordinates (x, y) that is on the line.
    • m is the slope, which tells how much the line goes up (increasing y) for every unit you move over to the right (increasing x) – we often say that the value of the slope is \(\ m=\frac{rise}{run}\).
      • positive, if the line is tilted up,
      • negative, if the line is tilted down,
      • zero, if the line is horizontal, and
      • undefined, if the line is vertical.
    • You can calculate the slope by finding the coordinates (x1, y1) and (x2, y2) of any y2 −y1 two points on the line and then \(\ m = \frac{y_2 - y_1}{x_2 - x_1}\).
    • In particular, x2−x1=1,then \(\ m =\frac{y_2 - y_1}{1} = y_2 - y_1\) - so if you look at how much the line goes up in each step of one unit to the right, that number will be the slope m (and if it goes down, the slope m will simply be negative). In other words, the slope answers the question “for each step to the right, how much does the line increase (or decrease)?”
    • b is the y-intercept, which tells the y-coordinate of the point where the line crosses the y-axis. Another way of saying that is that b is the y value of the line when the x is 0.

    • Was this article helpful?