Linear Regression Calculator

Fit a least-squares line to paired data and calculate slope, intercept, R² and an optional prediction

Your result will appear here.

About the Linear Regression Calculator

Linear Regression Calculator fits a straight line that predicts one variable from another by minimizing squared residuals. It is useful for trend estimation, calibration and simple predictive models when a linear relationship is reasonable.

A fitted line can summarize association, but it should not be extrapolated far beyond the observed data without strong justification.

How to Use the Linear Regression Calculator

  1. Enter paired x and y observations.
  2. Calculate slope and intercept.
  3. Review fit statistics such as correlation or R² when available.
  4. Inspect residuals or a scatter plot before using the line for prediction.

How the Calculation Works

Simple least-squares regression fits y = b0 + b1x. Slope b1 = covariance(x,y)/variance(x), and intercept b0 = ȳ − b1x̄.

The fitted coefficients minimize the sum of squared vertical residuals between observed y values and predicted values.

Worked example

Linear Regression Calculator Worked Example

Points (1,3), (2,5), (3,7)

These points lie exactly on y=2x+1, so the fitted slope is 2 and intercept is 1.

Result guide

Understanding Your Linear Regression Calculator Result

Slope estimates the average change in predicted y for a one-unit increase in x. The intercept is the predicted y at x=0, which may or may not be meaningful in context.

Before you rely on the answer

Assumptions and Limitations

  • A linear model is appropriate for the relationship.
  • Observations are paired and measured consistently.
  • Statistical inference from the regression requires additional assumptions about residuals and sampling.

Practical tip

Using This Result in Practice

Do not judge a regression only by R². A high R² can still accompany biased residual patterns or meaningless extrapolation.

Authoritative references

Useful Official Sources

For standards, definitions or real-world guidance related to this calculation, these primary sources may be useful:

Common questions

Linear Regression Calculator FAQ

What does regression slope mean?

The expected change in predicted y for a one-unit increase in x under the fitted linear model.

Is regression the same as correlation?

No. Correlation summarizes association symmetrically; regression fits a directional prediction equation.

Can I predict outside the observed x range?

You can mathematically, but extrapolation can be unreliable if the relationship changes beyond the data.