About the Regression Calculator
What is the Regression Calculator?
Linear regression finds the straight line that best describes how one variable (y) changes with another (x). The “least-squares” line is the one that makes the sum of the squared vertical distances from the points to the line as small as possible.
Enter matching lists of x and y values. The calculator returns the regression equation, the slope and intercept, R² (the share of the variation in y explained by x), a prediction for any x you choose, and a table of fitted values and residuals for every point.
How to use the Regression Calculator
- X Values (separated by commas) — the explanatory (independent) variable. (sample: 1, 2, 3, 4, 5, 6)
- Y Values (same order) — the response (dependent) variable, in the same order as x. (sample: 2.1, 3.9, 6.2, 7.8, 10.1, 12.2)
- Predict Y for this X — the x value to make a prediction for. (sample: 7)
- Press Fit Regression Line (results also refresh as you type). The result card shows the Regression Equation, along with Slope (b), Intercept (a), R² (goodness of fit) and Predicted Y at X = 7.
Formula used
b = Σ(x − x̄)(y − ȳ) ÷ Σ(x − x̄)², a = ȳ − b x̄
- b = the slope: the change in y for each 1-unit increase in x
- a = the intercept: the predicted y when x = 0
- R² = [Σ(x − x̄)(y − ȳ)]² ÷ [Σ(x − x̄)² × Σ(y − ȳ)²]
A residual is the actual y minus the fitted y. Residuals that show a pattern (a curve or a funnel) suggest a straight line is not the right model.
Worked example
These are the sample values already filled in the calculator above, and the result it returns for them:
| Input | Sample value |
|---|---|
| X Values (separated by commas) | 1, 2, 3, 4, 5, 6 |
| Y Values (same order) | 2.1, 3.9, 6.2, 7.8, 10.1, 12.2 |
| Predict Y for this X | 7 |
| Result | Value |
|---|---|
| Regression Equation | y = 2.02x − 0.02 |
| Slope (b) | 2.02 |
| Intercept (a) | -0.02 |
| R² (goodness of fit) | 0.9982 |
| Predicted Y at X = 7 | 14.12 |
Tips for using the Regression Calculator
- Be cautious predicting far outside the range of your x data (extrapolation).
- R² close to 1 means the line fits closely; it does not prove that x causes y.
- Plot the data first — a single outlier can change the slope a lot.
