Enter paired x,y data points to find the best-fit line's slope, intercept, and how strongly the two variables correlate.
Least-squares linear regression finds the straight line that minimizes the total squared distance between the line and each data point. That line is described by a slope and intercept, and its correlation coefficient (r) tells you how strongly the x and y values move together.
Slope (m) = [n·Σxy − Σx·Σy] ÷ [n·Σx² − (Σx)²]
Intercept (b) = [Σy − m·Σx] ÷ n
r = [n·Σxy − Σx·Σy] ÷ √{[n·Σx² − (Σx)²]·[n·Σy² − (Σy)²]}
Enter your paired data points, one "x,y" pair per line (comma-separated). The calculator computes the best-fit line y = mx + b, along with the correlation coefficient and R-squared value showing how well the line fits your data.
For the sample points (1,2), (2,4.1), (3,5.9), (4,8.2), (5,9.8), the best-fit line comes out to approximately y = 1.98x − 0.03, with a correlation coefficient near 0.9997 — indicating an almost perfectly linear relationship.
It fits a straight line through data points using the least-squares method to minimize squared distance from each point.
How much the dependent variable (y) is predicted to change per one-unit increase in x.
How well the line fits the data, from 0 to 1 — closer to 1 means a better fit.