Least Squares Line Calculator

Paste your X and Y data points to find the best-fit line that minimizes the squared residuals.

How to use

  1. Enter your values in the fields above.
  2. Press Calculate to see your result instantly.
  3. Use the Share button to copy a link to your result.

About this calculator

Ordinary least squares fits the straight line through a set of X-Y data points that minimizes the sum of the squared vertical distances (residuals) between each point and the line — the reason it's called 'least squares.' The slope and intercept have closed-form solutions (slope = Σ(x−x̄)(y−ȳ) ÷ Σ(x−x̄)², intercept = ȳ − slope×x̄), and the correlation coefficient r indicates how well the line actually captures the relationship in the data, from -1 (perfect negative) to +1 (perfect positive).

This calculator takes pasted X and Y data pairs and returns the fitted line's equation, slope, intercept, and correlation coefficient. Statistics and science students learning regression, researchers doing a quick trend analysis, and analysts checking a correlation before committing to a full statistical model use it as a fast way to quantify a linear relationship in a data set without opening a spreadsheet or stats package.

Was this helpful?

Comments (0)

  • Be the first to comment.

Popular calculators

All Calculators