Linear Regression Calculator
Best fit line for paired data.
Reviewed by the Calculation Machine team · How we check our maths
Your values
ⓘ Live results
Results
- Equation
- y = 1.99286x + 0.25714
- Slope
- 1.992857
- Intercept
- 0.257143
- R squared
- 0.99827
- Prediction
- 20.18571
Quick answer
Least squares regression finds the line minimising squared vertical distances, giving y = mx + b.
The formula
m = Σ(x−x̄)(y−ȳ)/Σ(x−x̄)², b = ȳ − mx̄
Worked example
Worked example
Using the values the calculator loads with.
Inputs
- X values1, 2, 3, 4, 5, 6, 7
- Y values2.1, 4.3, 6.2, 8.5, 10.1, 12.4, 14.0
- Predict y at x =10
Result
- Equationy = 1.99286x + 0.25714
- Slope1.992857
- Intercept0.257143
- R squared0.99827
- Prediction20.18571
How to use the Linear Regression Calculator
- 1Paste your X values.
- 2Paste matching Y values.
- 3Enter an x value to predict.
Frequently asked questions
What is a good R squared?
Depends on field — 0.9+ in physics, 0.3 can be meaningful in social science.
Can I extrapolate?
Cautiously — predictions outside your data range are unreliable.
About this calculator
- Built and reviewed by the Calculation Machine team · How we build and test calculators
- Report an error