Statistics

Linear Regression Calculator

Linear regression finds the straight line that best fits a set of data points. This calculator computes the least-squares slope and intercept, plus the correlation coefficient r and r², from your paired x and y values.

Linear Regression Calculator

Least-squares line and correlation for paired data.

Try:
Answery = 0.8x + 1.8 (r = 0.852803)
  1. Meansx̄ = 3, ȳ = 4.2
  2. Sums of squaresSxx = 10, Sxy = 8
  3. Slopeb = Sxy / Sxx = 0.8
  4. Intercepta = ȳ − b·x̄ = 1.8
  5. Correlationr = 0.852803, r² = 0.727273
  6. Regression liney = 0.8x + 1.8

Worked examples

Key terms

Frequently asked questions

What is the least-squares line?

It is the line that minimizes the total squared vertical distance between the data points and the line.

What does the correlation coefficient r mean?

r ranges from −1 to 1: values near ±1 indicate a strong linear relationship, values near 0 indicate a weak one.

What is r²?

r² is the fraction of the variation in y explained by the regression line — a measure of fit quality.