Statistics
Linear Regression Calculator
Pair two numeric lists to see the slope, intercept, R², and a quick ŷ prediction for whatever X you care about.
Feed paired X and Y values to get slope, intercept, R², and a fast prediction for any X.
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
- Enter X values separated by commas, spaces, or new lines.
- Enter the matching Y values in the same order and length.
- 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.