Your Equation

Library / Statistics / STA-07

Statistics

Regression slope

Slope of the least-squares line: how much y changes, on average, for a one-unit rise in x.

Ref
STA-07
Rev
v1
Field
Statistics
Result
b

S_xy = Σ(x − x̄)(y − ȳ) and S_xx = Σ(x − x̄)². The least-squares line is y = ȳ + b(x − x̄), so it always passes through the point of means. b has units of y per unit of x.

Slope of the least-squares line: how much y changes, on average, for a one-unit rise in x.

Calculator

Solve for
−1,0001,000
11,000
  • Change in y for a 10-unit rise in x12
  • Change in x along the line for a 1-unit change in y0.8333

What drives the result

Each variable is moved across its typical range while the others stay at the values above. The longest bar is the key driver.

Slope () current value 1.2
SxxSum of squares of xKey driver
0.12120
SxySum of cross-products
−1010
  • A slope of 1.2 means y rises by 1.2 units on average for each unit increase in x.
  • Do not extrapolate far beyond the range of x in the data: the straight line may stop holding.
Chart data as tables

Ranked variables

VariableTypical rangeLowest resultHighest resultSwing ()Local stepChange in result
Sxx Sum of squares of x1 to 1,000 0.12120119.9+10%−9.09 %
Sxy Sum of cross-products−1,000 to 1,000 −101020+40 +33.3 %

Sweep of Sum of squares of x

Sum of squares of xSlope
1120
2.37150.6
5.62321.34
13.348.999
31.623.795
74.991.6
177.80.6748
421.70.2846
1,0000.12

Sweep one variable

Slope ()Hover, touch, or use the arrow keys on the chart
020406080100120 1520100500 Sum of squares of x, log scale now 1.2

Variables and how each one contributes

b

Slope

Result ·

What the equation gives you. Everything else feeds it.

Sxy

Sum of cross-products

· typical −1,000 to 1,000

The sum of the products of the x and y deviations. Directly proportional; a negative S_xy gives a falling line.

Sxx

Sum of squares of x

· typical 1 to 1,000

The sum of squared deviations of x. Inverse: x values clustered closely (small S_xx) give a steep, poorly-determined slope.

Worked example with the values above

  1. Cross-products: S_xy = 120.
  2. Sum of squares of x: S_xx = 100.
  3. b = 120 / 100 = 1.2.

Assumptions and limits

  • A straight-line relationship, with scatter in y roughly constant across x.
  • x is measured much more accurately than y.

Common mistakes

  • Swapping x and y: the slope of x on y is not the reciprocal of the slope of y on x.
  • Using the slope without checking how well the line fits.

Statistics and uncertainty

The slope has its own standard error, s/√S_xx. If the interval around the slope includes zero, the data do not support a trend.

Where it is used

  • Fitting a calibration line to instrument readings.
  • Estimating a rate of change from noisy data.

Maths you need

  • Straight lines: gradient and intercept
  • Sums of squares: S_xx

Related formulas

Practise this formula