# How to Find Linear Regression Equation from a Table

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, X2, and Y2

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

• x*y
• x2
• y2

The following screenshot shows how to do so: ## Step 2: Calculate ΣX, ΣY, ΣX*Y, ΣX2, and ΣY2

Next, we’ll calculate the sum of each column: ## Step 3: Calculate b0

The formula to calculate the intercept of the regression equation, b0, is as follows:

• b0 = ((Σy)(Σx2) – (Σx)(Σxy))  /  (n(Σx2) – (Σx)2)
• b0 = ((128)(831) – (85)(1258))  /  (10(831) – (85)2)
• b0 = -0.518

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

## Step 4: Calculate b1

The formula to calculate the slope of the regression equation, b1, is as follows:

• b1 =  (n(Σxy) – (Σx)(Σy))  /  (n(Σx2) – (Σx)2)
• b1 = (10(1258) – (85)(128))  /  (10(831) – (85)2)
• b1 = 1.5668

## Step 5: Write Linear Regression Equation

The final linear regression equation can be written as:

• ŷ = b0 + b1x

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.