Math
Regression Calculator
Fit a least-squares line to your (x, y) data. Get slope, intercept, R squared, Pearson r, standard error, residuals, and a predicted y value.
Linear Regression
Separate x and y with a comma, tab, semicolon, or space. Paste spreadsheet columns directly. Needs at least 2 points with at least 2 different x values.
Optional. Leave blank to skip the point prediction.
Best-fit line
Slope (m)
1
Intercept (b)
1.3333
R squared
0.84
Pearson r
0.9165
Std. error
0.9129
Points (n)
6
Predicted value
At x = 7, y = 8.3333
Points and residuals
| x | y | Predicted | Residual |
|---|---|---|---|
| 1 | 2 | 2.3333 | -0.3333 |
| 2 | 4 | 3.3333 | 0.6667 |
| 3 | 5 | 4.3333 | 0.6667 |
| 4 | 4 | 5.3333 | -1.3333 |
| 5 | 6 | 6.3333 | -0.3333 |
| 6 | 8 | 7.3333 | 0.6667 |
Frequently Asked Questions about the Regression Calculator
What does this regression calculator do?
It fits a straight line y = mx + b through your data points using ordinary least squares. You get the slope, intercept, equation, R squared, Pearson correlation r, standard error of the estimate, and the residual for each point. Add an x value and it also predicts the matching y.
How many data points do I need?
At least 2 points with at least 2 different x values. With only 2 points you get a perfect fit by construction, so R squared equals 1 and the standard error is reported as 0. Standard error is most useful from about 5 or 6 points upward.
What does R squared mean?
R squared is the share of the variance in y that the line explains, between 0 and 1. An R squared of 0.85 means the line explains 85 percent of the variation in your y values. The rest is scatter the line cannot capture.
Why did the calculator return no result?
Two reasons. Either you entered fewer than 2 valid points, or every x value is the same. A vertical line has an undefined slope under least squares, so the calculator returns no equation rather than a misleading one.
Can I use this for curved data?
No. This tool is strictly linear regression. If your data follows a curve, transform it first (for example, take the log of y for exponential growth or use x squared for a parabola) and then fit a line to the transformed values.