How to Write a Linear Regression Equation From a Table

Writing a linear regression equation from a table comes down to finding two numbers: the intercept and the slope. Once you locate those values in your table, you plug them into the standard form ŷ = b₀ + b₁x. The process is the same whether you’re reading output from Excel, SPSS, Google Sheets, or a textbook problem.

The Standard Form of the Equation

A linear regression equation follows the same structure as the slope-intercept form you learned in algebra (y = mx + b), just with different notation. In statistics, the equation is typically written as:

ŷ = b₀ + b₁x

Here, b₀ is the y-intercept, which is the predicted value of y when x equals zero. b₁ is the slope, which tells you how much y changes for every one-unit increase in x. The symbol ŷ (called “y-hat”) means this is a predicted value rather than an actual observed data point. That distinction matters because no regression line passes perfectly through every point in your data.

Finding the Intercept and Slope in a Table

Different software and textbooks label these values differently, which is where most of the confusion comes from. The intercept might appear as “Constant,” “Intercept,” or simply “(Const)” in the first row of a coefficients table. The slope appears in the row labeled with the name of your independent variable, such as “X Variable 1,” “Height,” “Years of Experience,” or whatever your predictor is called.

The column containing the actual numbers you need is usually labeled “B,” “Coefficient,” “Estimate,” or “Parameter Estimate.” Ignore the other columns for now (standard error, t-statistic, p-value). You only need the values in that one column to write your equation.

Here’s how a typical Excel regression output looks in the relevant section:

  • Row labeled “Intercept”: this value is your b₀
  • Row labeled “X Variable 1”: this value is your b₁ (your slope)

In SPSS, the intercept row is labeled “Constant” and the coefficients appear in the “B” column. The logic is identical regardless of software.

A Worked Example

Suppose you run a regression predicting teacher salary based on years of experience, and your output table shows:

  • Intercept: 4269.9
  • Total Years of Experience: 52.32

You take the intercept value (4269.9) and the slope value (52.32) and drop them into the equation:

ŷ = 4269.9 + 52.32x

That’s it. This equation tells you that the predicted starting salary (when experience is zero years) is $4,269.90, and each additional year of experience adds $52.32 to the predicted salary. If you wanted to predict the salary for someone with 10 years of experience, you’d calculate 4269.9 + 52.32(10) = $4,793.10.

Reading a Raw Data Table Instead of Output

If your table contains raw x and y values rather than pre-calculated coefficients, you need to compute the slope and intercept yourself. This is common in textbook exercises and homework problems.

To calculate the slope (b₁), you need three things from your data: the mean of x, the mean of y, and the individual x and y values. The formula is:

b₁ = Σ(xᵢ – x̄)(yᵢ – ȳ) / Σ(xᵢ – x̄)²

In plain terms: for each data point, multiply how far x is from its average by how far y is from its average. Add those products up. Then divide by the sum of the squared distances of each x from its average. The result is your slope.

Once you have the slope, the intercept is straightforward:

b₀ = ȳ – b₁ · x̄

This just means: take the average y value, then subtract the slope times the average x value. Now plug both numbers into ŷ = b₀ + b₁x and you have your equation.

Step-by-Step With Numbers

Say your table has five data points:

  • x values: 1, 2, 3, 4, 5
  • y values: 3, 5, 6, 8, 10

First, find the means. The mean of x is (1+2+3+4+5)/5 = 3. The mean of y is (3+5+6+8+10)/5 = 6.4.

Next, build a small working table. For each data point, calculate (xᵢ – x̄), (yᵢ – ȳ), their product, and (xᵢ – x̄) squared. When x is 1: deviations are (1-3) = -2 and (3-6.4) = -3.4, product is 6.8, squared x-deviation is 4. Repeat for every row. Sum the products column to get 17. Sum the squared x-deviation column to get 10.

The slope is 17/10 = 1.7. The intercept is 6.4 – 1.7(3) = 1.3. Your equation:

ŷ = 1.3 + 1.7x

This tells you that for every one-unit increase in x, y increases by 1.7. When x is zero, the predicted y is 1.3.

Interpreting the Sign of the Slope

A positive slope means x and y move in the same direction: as x goes up, y goes up. A negative slope means they move in opposite directions: as x increases, y decreases. For instance, a slope of -10.7 on a regression predicting test scores from hours of TV watched would mean each additional hour of TV is associated with a drop of 10.7 points in the predicted score.

The size of the slope depends entirely on the units involved. A slope of 0.003 is not necessarily “weak” if x is measured in milligrams and y in tons. Always think about what one unit of x actually represents before judging whether a slope is meaningful.

When There Are Multiple Predictors

If your table includes more than one independent variable, you’re looking at multiple linear regression. The equation expands to:

ŷ = b₀ + b₁x₁ + b₂x₂ + … + bₚxₚ

Each row in the coefficients table (other than the intercept row) gives you one slope value for one predictor. You read each coefficient the same way: it represents the predicted change in y for a one-unit increase in that particular variable, holding all other variables constant.

Using the teacher salary example, a fuller equation with gender (coded as 1 for male, 0 for female) and years of experience would look like:

ŷ = 4269.9 + 632.38(Gender) + 52.32(Experience)

For a female teacher (Gender = 0) with 10 years of experience, the prediction is 4269.9 + 0 + 52.32(10) = $4,793.10. For a male teacher with the same experience, it’s 4269.9 + 632.38 + 523.2 = $5,425.48. Each coefficient applies independently.

Common Mistakes to Avoid

The most frequent error is swapping the intercept and slope. Always check which row is labeled as the intercept or constant, and make sure you put that number as the standalone term in the equation, not attached to x.

Another common mistake is using the wrong column. Regression output tables typically have several columns. You want the raw “B” or “Coefficient” column, not the “Standardized Coefficient” (often labeled “Beta”) column. Standardized coefficients are rescaled for comparison purposes and will give you the wrong equation for making predictions.

Finally, pay attention to negative signs. If your intercept or slope is negative, that negative sign is part of the number. An intercept of -10.7 means the equation is ŷ = -10.7 + 2.8x, not ŷ = 10.7 + 2.8x.