Linear regression calculator
Find the best-fit line y = mx + b for your data. Shows slope, intercept, R, and R² with full calculation steps.
X values
Y values
Linear regression formula
The least-squares regression line y = mx + b minimizes the sum of squared residuals.
Slope: m = [nΣxy − ΣxΣy] / [nΣx² − (Σx)²]
Intercept: b = ȳ − m·x̄
What is R² (coefficient of determination)?
R² tells you what percentage of variation in y is explained by x. R² = 1.0 means perfect fit. R² = 0 means no linear relationship. Values above 0.7 are generally considered strong.
Interpreting the results
Positive slope: As x increases, y tends to increase.
Negative slope: As x increases, y tends to decrease.
Correlation (R): Values near ±1 = strong linear relationship. Near 0 = weak/no relationship.
Example datasets
Related calculators