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 = (n * sum_xy - sum_x * sum_y) / (n * sum_x2 - pow(sum_x, 2))Variables
| Variable | Description | Default |
|---|---|---|
n | Number of Data Points (n) | 10 |
sum_xy | Sum of x*y (Σxy) | 3500 |
sum_x | Sum of x (Σx) | 150 |
sum_y | Sum of y (Σy) | 200 |
sum_x2 | Sum of x² (Σx²) | 2850 |
How It Works
Linear Regression Slope
The slope of the least-squares regression line measures the average change in y for each one-unit increase in x.
Formula
b1 = (n × Σxy - Σx × Σy) / (n × Σx² - (Σx)²)
This is derived by minimizing the sum of squared residuals. A positive slope indicates a positive relationship; negative slope indicates an inverse relationship.
Worked Example
Given n=10, Σxy=3500, Σx=150, Σy=200, Σx²=2850.
n = 10sum_xy = 3500sum_x = 150sum_y = 200sum_x2 = 2850
- 01Numerator = 10(3500) - 150(200) = 35000 - 30000 = 5000
- 02Denominator = 10(2850) - 150² = 28500 - 22500 = 6000
- 03b1 = 5000 / 6000 = 0.8333
Ready to run the numbers?
Open Linear Regression Slope Calculator