Linear Regression Calculator

Fit a least-squares line to paired observations and calculate slope, intercept, R² and a prediction at a selected x value.

Predicted y on the fitted line9.5000

-1000000000 – 1000000000

Predicted y on the fitted line

9.5000

  • Slope1.9000
  • Intercept0.0000
  • 0.9627

Ordinary least squares with an intercept. A fitted association is not causation. Predictions outside observed x values are extrapolations; this tool does not calculate prediction intervals.

How this was calculated

Slope = Σ(x − mean x)(y − mean y) ÷ Σ(x − mean x)².

Intercept = mean y − slope × mean x.

Predicted y = intercept + slope × selected x.

Formula and method

Slope = Σ(x − x̄)(y − ȳ)/Σ(x − x̄)². Intercept = ȳ − slope × x̄. The prediction is intercept + slope × x.

Worked example

For x values 1, 2, 3 and y values 3, 5, 7, the fitted line is y = 1 + 2x with R² = 1.

Frequently asked questions

Does a high R² prove causation?

No. It describes fit within the observed sample. It does not establish causation or make extrapolation reliable, and this tool does not provide prediction intervals.

Last updated . Results are estimates for informational purposes only.