Linear Regression Calculator
Linear regression calculator
Fit least-squares line y = mx + b with correlation and optional prediction.
InputsStatistics2 fieldsLive
Result
y = 0.6x + 2.2
r = 0.77459667, R^2 = 0.6, y(6) = 5.8.
Live update
stats
Advanced options
Flow
- Enter x,y pairs with one pair per line.
- Optionally set prediction x value.
- Read slope, intercept, r, R², and predicted y.
Example
Worked example: pairs (1,2),(2,4),(3,5),(4,4),(5,5)
- 1 Compute x̄ and ȳ from paired data.
- 2 Use least-squares slope and intercept equations.
- 3 Obtain model y = 0.6x + 2.2 and R² = 0.6
Best-fit line is y = 0.6x + 2.2.
How
- Enter x,y pairs with one pair per line.
- Optionally set prediction x value.
- Read slope, intercept, r, R², and predicted y.
Avoid
- Providing unequal counts of x and y values.
- Using regression for non-linear relationships without residual checks.
- Assuming correlation implies causation.
FAQ
What does R² mean?
R² is proportion of variance explained by the fitted linear model.
Can this handle vertical lines?
No. If all x values are identical, slope is undefined for y-on-x regression.
Should I remove outliers first?
Evaluate data context; outliers can strongly affect linear fit.
Switch
Switch12
No match.