CalcUnit Logo

How to Calculate Regression

Use this free Regression Calculator to compute regression instantly. Includes the formula, examples, and FAQs.

The Formula

ŷ = a + bx

The 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:

VariableTypeExample value
X Value 1Input (you provide)1
X Value 2Input (you provide)2
X Value 3Input (you provide)3
X Value 4Input (you provide)4
X Value 5Input (you provide)5
Y Value 1Input (you provide)2
Y Value 2Input (you provide)4
Y Value 3Input (you provide)5
Y Value 4Input (you provide)4
Y Value 5Input (you provide)5
X Value to Predict AtInput (you provide)6
Sum of XResult (calculated)—
Sum of YResult (calculated)—
Sum of X SquaredResult (calculated)—
Sum of Y SquaredResult (calculated)—
Sum of XY ProductsResult (calculated)—
Slope (b)Result (calculated)—
Intercept (a)Result (calculated)—
Correlation Coefficient (r)Result (calculated)—
R SquaredResult (calculated)—
Predicted YResult (calculated)—

Step-by-Step Method

  1. 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.
  2. 2Substitute your known values into the formula: ŷ = a + bx.
  3. 3Work through the arithmetic in the standard order of operations — parentheses first, then exponents, then multiplication and division, then addition and subtraction.
  4. 4Check that your result carries the correct unit and falls in a reasonable range for the problem.
  5. 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 1Sum of XSum of YSum of X SquaredSum of Y SquaredSum of XY ProductsSlope (b)Intercept (a)Correlation Coefficient (r)R SquaredPredicted Y
0.314.3020.0054.0986.0064.600.56092.39570.83180.69185.7614
0.514.5020.0054.2586.0065.000.57382.33610.81820.66945.7787
0.814.8020.0054.6486.0065.600.59082.25110.79390.63025.7962
115.0020.0055.0086.0066.000.60002.20000.77460.60005.8000
216.0020.0058.0086.0068.000.58822.11760.62620.39225.6471
317.0020.0063.0086.0070.000.38462.69230.35810.12825.0000
418.0020.0070.0086.0072.000.00004.00000.00000.00004.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

statisticsregressionmath

Use the Interactive Calculator

Skip the manual math — get instant results with our free Regression calculator.

Open Calculator

Related Calculators