Statistics

Linear Regression Calculator

Pair two numeric lists to see the slope, intercept, R², and a quick ŷ prediction for whatever X you care about.

regressiontrendlineslopeprediction
Linear Regression Calculator

Feed paired X and Y values to get slope, intercept, R², and a fast prediction for any X.

Pairs processed
5
Slope (m)
1.83
Intercept (b)
-0.39
Correlation (r)
0.99
0.979
Mean of X
3
Mean of Y
5.1
Prediction (x = 6)
10.59
Regression line
y = 1.83x - 0.39

Regression Fit

Least-squares line

m = Σ((x − x̄)(y − ȳ)) / Σ(x − x̄)²
b = ȳ − m x̄
ŷ = b + mx

The calculator centers your data, computes the best-fit slope m and intercept b, and reports the coefficient of determination R² for that simple linear model.

How to use

  1. Enter X values separated by commas, spaces, or new lines.
  2. Enter the matching Y values in the same order and length.
  3. Optionally set an X value to forecast so the tool returns ŷ for that input.

Example

Input: X = 1, 2, 3, 4, 5; Y = 1.8, 3.2, 4.4, 7.1, 9.0; Predict x = 6

Output: Slope ≈ 1.82, Intercept ≈ 0.04, R² ≈ 0.98, Prediction ≈ 10.0

FAQ & notes

What happens if every X value is identical?

Vertical lines cannot be expressed as y = mx + b, so the slope is undefined and the calculator will ask for more varied X values.

Can I enter blanks or text?

Non-numeric tokens are ignored, so you can safely paste spreadsheet columns that contain labels or missing values as long as both lists stay the same length.