MathematicsStatistics and Regression AnalysisUniversity

Simple Linear Regression Line Calculator

This equation defines the line of best fit that minimizes the sum of squared residuals between observed and predicted values for a linear relationship between two variables.

Use the free calculatorCheck the variablesOpen the advanced solver

A lightweight calculator preview is not available for this formula yet.

Use the advanced calculator to solve it interactively.

Formula first

Overview

The regression line is calculated using the Ordinary Least Squares (OLS) method, which seeks to minimize the variance of the errors. The slope, b1, represents the expected change in y per unit change in x, while the intercept, b0, indicates the predicted value of y when x is zero. Together, these parameters characterize the linear trend within a dataset.

Symbols

Variables

y^ = Predicted Value, = Slope, = Y-Intercept, x = Independent Variable, n = Sample Size

y^
Predicted Value
Variable
Slope
Variable
Y-Intercept
Variable
Independent Variable
Variable
Sample Size
Variable
\hat{y}
Variable

Apply it well

When To Use

When to use: Use this when you need to model the relationship between two continuous variables and predict future outcomes based on linear trends.

Why it matters: It is the foundational tool for predictive analytics, enabling researchers and businesses to forecast trends and quantify the strength of relationships between variables.

Avoid these traps

Common Mistakes

  • Assuming that a strong correlation implies causation.
  • Extrapolating the regression line far beyond the range of the observed x data.

One free problem

Practice Problem

Given the data points (1, 2), (2, 3), and (3, 5), calculate the slope b1 of the regression line.

Sample Size3
sum_xy23
sum_x6
sum_y10
sum_x214

Solve for:

Hint: Calculate the numerator n*sum(xy) - sum(x)*sum(y) and the denominator n*sum() - (sum(x))^2 separately.

The full worked solution stays in the interactive walkthrough.

References

Sources

  1. Montgomery, D. C., Peck, E. A., & Vining, G. G. (2012). Introduction to Linear Regression Analysis.
  2. Freedman, D., Pisani, R., & Purves, R. (2007). Statistics.