Linear Regression Slope Calculator Formula
Understand the math behind the linear regression slope calculator. Each variable explained with a worked example.
Formulas Used
Slope (b1)
slope = slope_num / slope_denMean of x
x_mean = sum_x / nMean of y
y_mean = sum_y / nVariables
| Variable | Description | Default |
|---|---|---|
n | Number of Pairs | 5 |
sum_xy | Sum of (x*y) | 2350 |
sum_x | Sum of x | 75 |
sum_y | Sum of y | 150 |
sum_x2 | Sum of x-squared | 1175 |
slope_num | Derived value= n * sum_xy - sum_x * sum_y | calculated |
slope_den | Derived value= n * sum_x2 - pow(sum_x, 2) | calculated |
How It Works
How to Calculate the Regression Slope
Formula
b1 = [n*Sum(xy) - Sum(x)*Sum(y)] / [n*Sum(x^2) - (Sum(x))^2]
The slope of the least-squares regression line represents the predicted change in Y for a one-unit increase in X. A positive slope indicates a positive relationship; negative means Y decreases as X increases.
Worked Example
n = 5, Sum(xy) = 2350, Sum(x) = 75, Sum(y) = 150, Sum(x^2) = 1175.
n = 5sum_xy = 2350sum_x = 75sum_y = 150sum_x2 = 1175
- 01Numerator = 5*2350 - 75*150 = 11750 - 11250 = 500
- 02Denominator = 5*1175 - 75^2 = 5875 - 5625 = 250
- 03Slope b1 = 500 / 250 = 2.0
- 04For each unit increase in x, y increases by 2 on average
Ready to run the numbers?
Open Linear Regression Slope Calculator