How to Calculate Regression
Use this free Regression Calculator to compute regression instantly. Includes the formula, examples, and FAQs.
The Formula
ŷ = a + bxThe regression formula uses the mathematical relationship: ŷ = a + bx. Each variable in the formula represents a measurable quantity that affects the final result.
What Each Variable Means
Every value in the regression formula, what it measures, and the value used in the worked example on this page:
| Variable | Type | Example value |
|---|---|---|
| X Value 1 | Input (you provide) | 1 |
| X Value 2 | Input (you provide) | 2 |
| X Value 3 | Input (you provide) | 3 |
| X Value 4 | Input (you provide) | 4 |
| X Value 5 | Input (you provide) | 5 |
| Y Value 1 | Input (you provide) | 2 |
| Y Value 2 | Input (you provide) | 4 |
| Y Value 3 | Input (you provide) | 5 |
| Y Value 4 | Input (you provide) | 4 |
| Y Value 5 | Input (you provide) | 5 |
| X Value to Predict At | Input (you provide) | 6 |
| Sum of X | Result (calculated) | — |
| Sum of Y | Result (calculated) | — |
| Sum of X Squared | Result (calculated) | — |
| Sum of Y Squared | Result (calculated) | — |
| Sum of XY Products | Result (calculated) | — |
| Slope (b) | Result (calculated) | — |
| Intercept (a) | Result (calculated) | — |
| Correlation Coefficient (r) | Result (calculated) | — |
| R Squared | Result (calculated) | — |
| Predicted Y | Result (calculated) | — |
Step-by-Step Method
- 1Write down the values you know: X Value 1, X Value 2, X Value 3, X Value 4, X Value 5, Y Value 1, Y Value 2, Y Value 3, Y Value 4, Y Value 5, X Value to Predict At.
- 2Substitute your known values into the formula: ŷ = a + bx.
- 3Work through the arithmetic in the standard order of operations — parentheses first, then exponents, then multiplication and division, then addition and subtraction.
- 4Check that your result carries the correct unit and falls in a reasonable range for the problem.
- 5Verify your answer with the interactive Regression Calculator — it solves the same formula instantly.
Worked Example
Take a concrete case: x value 1 = 0.5, with the other inputs at the typical values from the variables table above. Substituting into the formula gives sum of x = 14.50, sum of y = 20.00, sum of x squared = 54.25, sum of y squared = 86.00, sum of xy products = 65.00, slope (b) = 0.5738, intercept (a) = 2.3361, correlation coefficient (r) = 0.8182, r squared = 0.6694, predicted y = 5.7787. These numbers are solved by the same engine that powers the Regression calculator, so you can reproduce them exactly by entering the same inputs there.
| X Value 1 | Sum of X | Sum of Y | Sum of X Squared | Sum of Y Squared | Sum of XY Products | Slope (b) | Intercept (a) | Correlation Coefficient (r) | R Squared | Predicted Y |
|---|---|---|---|---|---|---|---|---|---|---|
| 0.3 | 14.30 | 20.00 | 54.09 | 86.00 | 64.60 | 0.5609 | 2.3957 | 0.8318 | 0.6918 | 5.7614 |
| 0.5 | 14.50 | 20.00 | 54.25 | 86.00 | 65.00 | 0.5738 | 2.3361 | 0.8182 | 0.6694 | 5.7787 |
| 0.8 | 14.80 | 20.00 | 54.64 | 86.00 | 65.60 | 0.5908 | 2.2511 | 0.7939 | 0.6302 | 5.7962 |
| 1 | 15.00 | 20.00 | 55.00 | 86.00 | 66.00 | 0.6000 | 2.2000 | 0.7746 | 0.6000 | 5.8000 |
| 2 | 16.00 | 20.00 | 58.00 | 86.00 | 68.00 | 0.5882 | 2.1176 | 0.6262 | 0.3922 | 5.6471 |
| 3 | 17.00 | 20.00 | 63.00 | 86.00 | 70.00 | 0.3846 | 2.6923 | 0.3581 | 0.1282 | 5.0000 |
| 4 | 18.00 | 20.00 | 70.00 | 86.00 | 72.00 | 0.0000 | 4.0000 | 0.0000 | 0.0000 | 4.0000 |
How each result changes as x value 1 changes, holding the other inputs constant.
Practice Problems
1. Study time vs scores: X Value 1 1, X Value 2 2, X Value 3 3, X Value 4 4, X Value 5 5, and 6 more more inputs — work it out, then check the answer.
Answer: With X Value 1 1, X Value 2 2, X Value 3 3, X Value 4 4, X Value 5 5, and 6 more more inputs, the results are Sum of X 15.00, Sum of Y 20.00, Sum of X Squared 55.00, Sum of Y Squared 86.00, Sum of XY Products 66.00, and 5 more more results.
2. Plug in X Value 1 2.5, X Value 2 4, X Value 3 6, X Value 4 8, X Value 5 10, and 6 more more inputs. What is the answer?
Answer: Entering X Value 1 2.5, X Value 2 4, X Value 3 6, X Value 4 8, X Value 5 10, and 6 more more inputs gives Sum of X 30.50, Sum of Y 29.00, Sum of X Squared 222.25, Sum of Y Squared 195.00, Sum of XY Products 205.50, and 5 more more results.
Frequently Asked Questions
What is the formula for regression?
The formula is: ŷ = a + bx. Use this free Regression Calculator to compute regression instantly. Includes the formula, examples, and FAQs.
What values do I need to calculate regression?
You need x value 1, x value 2, x value 3, x value 4, x value 5, y value 1, y value 2, y value 3, y value 4, y value 5, x value to predict at. The calculator produces sum of x, sum of y, sum of x squared, sum of y squared, sum of xy products, slope (b), intercept (a), correlation coefficient (r), r squared, predicted y from those inputs.
What is the regression when x value 1 is 0.5?
With x value 1 = 0.5, the result is sum of x = 14.50, sum of y = 20.00, sum of x squared = 54.25, sum of y squared = 86.00, sum of xy products = 65.00, slope (b) = 0.5738, intercept (a) = 2.3361, correlation coefficient (r) = 0.8182, r squared = 0.6694, predicted y = 5.7787. This is worked through in full in the example on this page.
Related Topics
Use the Interactive Calculator
Skip the manual math — get instant results with our free Regression calculator.
