Often you may want to find a linear regression equation from a table of data.

For example, suppose you are given the following table of data:

The following step-by-step example explains how to find a linear regression equation from this table of data.

**Step 1: Calculate X*Y, X**^{2}, and Y^{2}

^{2}, and Y

^{2}

First, we’ll calculate the following metrics for each row:

- x*y
- x
^{2} - y
^{2}

The following screenshot shows how to do so:

**Step 2: Calculate ΣX, ΣY, ΣX*Y, ΣX**^{2}, and ΣY^{2}

^{2}, and ΣY

^{2}

Next, we’ll calculate the sum of each column:

**Step 3: Calculate b**_{0}

_{0}

The formula to calculate the intercept of the regression equation, b_{0}, is as follows:

- b
_{0}= ((Σy)(Σx^{2}) – (Σx)(Σxy)) / (n(Σx^{2}) – (Σx)^{2}) - b
_{0}= ((128)(831) – (85)(1258)) / (10(831) – (85)^{2}) **b**_{0}= -0.518

**Note**: In the formula, *n* represents the total number of observations. In this example, there were 10 total observations.

**Step 4: Calculate b**_{1}

_{1}

The formula to calculate the slope of the regression equation, b_{1}, is as follows:

- b
_{1}= (n(Σxy) – (Σx)(Σy)) / (n(Σx^{2}) – (Σx)^{2}) - b
_{1}= (10(1258) – (85)(128)) / (10(831) – (85)^{2}) **b**_{1}= 1.5668

**Step 5: Write Linear Regression Equation**

The final linear regression equation can be written as:

**ŷ = b**_{0}+ b_{1}x

Thus, our linear regression equation would be written as:

**ŷ = -0.518 + 1.5668x**

We can double check that this answer is correct by plugging in the values from the table into the Simple Linear Regression Calculator:

We can see that the linear regression equation from the calculator matches the one that we calculated by hand.

**Additional Resources**

The following tutorials provide additional information about linear regression:

Introduction to Simple Linear Regression

Introduction to Multiple Linear Regression

How to Interpret Regression Coefficients

Hello Zach,

I came across your explanation while trying to work on regression equations for Algebra II. I love the way you have this laid out but have a question.

Why did we need to compute y^2 (and the sum of y^2) if it isn’t used in the formulas?

OR

Is is it supposed to be sum of y^2 at the beginning of Step 3? (This made the most logical sense to me as a possible error.)