Regression lines are used for forecasting, trend analysis and calibration curves.
How to use the Linear Regression Calculator
- X values
- Y values
- Predict y at x =
Results update as you type, and every field accepts the units shown in its menu.
How it works
The slope minimises the sum of squared vertical distances between the points and the line.
Inputs explained
| Field | What to enter |
|---|---|
| X values | A list of numbers separated by commas, spaces or new lines |
| Y values | A list of numbers separated by commas, spaces or new lines |
| Predict y at x = | A number |
What each result means
- Slope (m) = slope([X values], [Y values])
- Intercept (b) = intercept([X values], [Y values])
- Predicted y = [Slope (m)]×[Predict y at x =] + [Intercept (b)]
- R² = corr([X values], [Y values])^2
Example values
How the main result changes when Predict y at x = changes and everything else stays at the example values above:
| Predict y at x = | Predicted y |
|---|---|
| 30 | 61.6 |
| 45 | 90.1 |
| 60 | 118.6 |
| 75 | 147.1 |
| 90 | 175.6 |
| 120 | 232.6 |
Formula
m = Σ(x − x̄)(y − ȳ) ÷ Σ(x − x̄)²b = ȳ − m x̄Worked example
Inputs — X values: 10, 20, 30, 40, 50; Y values: 25, 41, 62, 79, 101; Predict y at x =: 60.
Results — Slope (m) = 1.9; Intercept (b) = 4.6; Predicted y = 118.6; R² = 0.99746.
Frequently asked questions
Is extrapolation reliable?
Predictions outside the data range assume the trend continues, which may not hold.
What if the relationship is curved?
Consider polynomial or exponential regression.
What formula does the Linear Regression Calculator use?
m = Σ(x − x̄)(y − ȳ) ÷ Σ(x − x̄)².