A slope describes how much a predicted response changes when an input increases by one unit. In simple linear regression, it is the m in y = mx + b, the line’s rate of change. section 7.7
Temperature and sports-drink sales
A regression of temperature against sports-drink sales produces a slope of 9.74. Interpret that as an estimated 9.74 more sales for every one-degree Fahrenheit increase. The intercept is −405.26, but predicted negative sales at zero degrees make it less useful on its own. section 7.7
Slope also appears in models with several inputs:
- Multiple linear regression assigns one slope to each independent variable, such as house, lot, and backyard square footage. section 7.11
- Professional output usually labels the intercept β0 and the slopes β1, β2, and β3 rather than m and b. section 7.11
import numpy as np
from scipy.stats import linregress
x = np.array([51.5, 55.1, 63.0, 71.2, 73.0, 77.1, 88.1,
91.2, 93.0, 101.6])
y = np.array([100.98, 137.44, 237.8, 254.96, 263.45,
353.89, 450.32, 521.34, 503.13, 573.91])
m, b, r_value, p_value, std_err = linregress(x, y) #1
print(f"Slope: {m:.2f} (sales increase per "
f"degree Fahrenheit)") #2
print(f"Intercept: {b:.2f}") #2
print(f"Pearson Correlation: {r_value:.4f}") #2
print(f"P-value (for slope): {p_value:.10f}") #2
print(f"Standard error of slope: {std_err:.4f}") #2
# Slope: 9.74 (sales increase per degree Fahrenheit)
# Intercept: -405.26
# Pearson Correlation: 0.9889
# P-value (for slope): 0.0000000654
# Standard error of slope: 0.5173
Run the SciPy example to inspect the slope alongside the intercept, correlation, p-value, and standard error. section 7.7






