Linear Regression Calculator
Slope and intercept form calculator using least square fitting — find the best-fit line through any set of data points and predict values with the linear regression equation.
Google ad
Google ad
Google ad
Popular Calculators
FAQs
What is least square fitting and how does it work?
Least square fitting is the mathematical method used to find the best-fit line through a set of data points. It works by minimising the sum of the squared vertical distances (residuals) between each observed data point and the corresponding point on the fitted line. Squaring the residuals ensures that both positive and negative deviations contribute positively to the total error, and penalises larger errors more heavily than smaller ones. The result is a unique line defined by slope (m) and intercept (b) that has the smallest possible total squared error of any straight line fitted to that data.
What is the difference between slope and intercept in the regression equation y = mx + b?
The slope (m) describes how much Y changes for each one-unit increase in X. A slope of 2 means Y increases by 2 for every 1-unit increase in X. A negative slope means Y decreases as X increases. The intercept (b) is the value of Y when X equals zero — the point where the regression line crosses the Y-axis. Together, slope and intercept form the complete linear regression equation that describes the relationship between the two variables.
What does R² (coefficient of determination) mean?
R² measures how well the regression line fits the data — specifically, what proportion of the variation in Y is explained by the linear relationship with X. R² ranges from 0 to 1. An R² of 1.0 means the line passes exactly through all data points with perfect predictive accuracy. An R² of 0.95 means 95% of the variation in Y is explained by X. An R² below 0.5 suggests a weak linear relationship. R² is the square of Pearson's correlation coefficient r, so R² = r².