📈 Regression Calculator
Calculate simple linear regression (y = mx + b) from paired X and Y data. Get the slope, intercept, R², and make predictions for any X value.
Predict Y for a given X
| # | x | y | ŷ (predicted) | Residual (y−ŷ) | Residual² |
|---|
Linear Regression Formulas
How to Use Linear Regression
-
1Enter Paired DataInput X values (independent variable) and corresponding Y values (dependent variable) in comma-separated format.
-
2Review the EquationThe regression line y = mx + b gives you the best linear fit. m is the slope (rate of change) and b is where the line crosses the Y axis.
-
3Evaluate R²R² ranges from 0 to 1. Higher values mean the line explains more of the variance in Y. An R² of 0.9 means 90% of variation is captured.
-
4Make PredictionsEnter any X value in the prediction box to calculate the expected Y using y = mx + b. Only interpolate within your data range for reliable predictions.
Worked Example
X = 1, 2, 3, 4, 5 — Y = 2, 4, 5, 4, 5
Frequently Asked Questions
Linear regression finds the best-fit straight line through a set of data points, described by y = mx + b. It minimises the sum of squared differences between observed Y values and the predicted values on the line.
The slope (m) represents how much Y changes for a one-unit increase in X. A slope of 2 means every time X goes up by 1, Y is expected to go up by 2.
R² (coefficient of determination) is the proportion of variance in Y explained by X. R²=0.8 means 80% of the variation in Y is captured by the linear model. R²=1 is a perfect fit.
Substitute your X value into the equation y = mx + b. For reliable predictions, stay within the range of your original data (interpolation). Predictions beyond your data range (extrapolation) are less reliable.
Related Calculators
Correlation Calculator
Calculate Pearson correlation coefficient between two variables.
Standard Deviation Calculator
Calculate mean, variance, and standard deviation for any data set.
Mean Calculator
Calculate arithmetic mean, geometric mean, and harmonic mean for any data set.