Why Compare Regression Slopes?
A regression model can describe how an outcome changes with each of several predictors. Sometimes the question is not whether either predictor has a nonzero slope, but whether the estimated change associated with one predictor differs from the change associated with another. For instance, a researcher might ask whether an additional hour of one activity is associated with a different change in an outcome than an additional hour of another activity.
This is a question about the difference between two coefficients. It is not answered by looking separately at the two coefficient tests. The relevant test uses the estimated difference and its uncertainty, including the covariance between the two coefficient estimates.
Writing a Difference of Slopes as a Contrast
Consider a multiple linear regression model with two quantitative predictors and no interaction:
Here, \(\beta_1\) is the population regression slope for \(x_1\), holding the other predictors in the model fixed; \(\beta_2\) is the corresponding slope for \(x_2\). The question “Are these slopes equal?” can be written as a hypothesis about their difference:
The expression \(\beta_1-\beta_2\) is a linear contrast: it combines regression coefficients using specified weights, here \(1\) for \(\beta_1\), \(-1\) for \(\beta_2\), and \(0\) for the other coefficients. Its estimate is \(b_1-b_2\), where \(b_1\) and \(b_2\) are the fitted coefficient estimates.
A difference in slopes is most directly interpretable when the two predictors have comparable units and scales. For example, if both predictors are measured in hours, their slopes are changes in the outcome per hour. If one is measured in hours and the other in minutes, the numerical slopes refer to different-sized changes; a comparison may still be defined, but its interpretation depends on the chosen units.
Uncertainty in the Difference
The estimate \(b_1-b_2\) varies from sample to sample. Its variance depends on the variances of the two coefficient estimates and on their covariance:
This follows from the general variance rule \(\operatorname{Var}(A+B)=\operatorname{Var}(A)+\operatorname{Var}(B)+2\operatorname{Cov}(A,B)\), using \(A=b_1\) and \(B=-b_2\). Since \(\operatorname{Cov}(b_1,-b_2)=-\operatorname{Cov}(b_1,b_2)\), the covariance term is subtracted. Taking the square root gives the estimated standard error:
The covariance here is the estimated covariance between the two coefficient estimates from the same fitted model. It cannot generally be omitted or replaced by a comparison of the coefficients’ separate standard errors. As the earlier material on contrast standard errors explains, the covariance affects how uncertain the difference is.
The t Test for Equal Slopes
For the usual regression t test, assume the regression model has a correctly specified linear conditional mean, independent errors with mean zero and constant variance, and normally distributed errors for an exact small-sample t distribution. The predictor values are treated as fixed, or the analysis is understood conditional on them. The model must also be estimable: the predictors cannot be perfectly linearly dependent. Under these conditions, the contrast estimate has standard error \(SE(b_1-b_2)\), and under the null hypothesis its t statistic is compared with a t distribution using the residual degrees of freedom from the full fitted model.
For the two-sided alternative, the p-value is the probability, assuming \(H_0\) and the model assumptions, of observing a t statistic at least as far from zero as the one calculated. A small p-value is evidence against equal population slopes; it does not measure the probability that the null hypothesis is true.
Worked Example: Comparing Two Slopes Measured in Hours
Suppose a hypothetical model predicts a quiz score from weekly hours spent in two activities, along with other specified predictors. Both activity variables are measured in hours per week, and the outcome is measured in quiz-score points. The fitted slopes are \(b_1=1.80\) and \(b_2=1.10\) points per hour. Their standard errors are \(0.40\) and \(0.30\), and their estimated covariance is \(0.060\). The model has \(df=36\). For this hypothetical analysis, assume independent observations and that residual checks support the linearity, constant-variance, and approximate-normality conditions.
The estimated slope difference is
The standard error of this difference is
To test \(H_0:\beta_1-\beta_2=0\) against a two-sided alternative, calculate
With \(df=36\), the two-sided p-value is approximately \(0.060\). At significance level \(\alpha=0.05\), this result does not provide sufficient evidence that the two population slopes differ. The estimated difference is \(0.700\) quiz-score points per additional weekly hour, but the uncertainty is large enough that the test does not rule out an equal-slope value.
Worked Tests and Interpretation
Worked Example: A Negative Covariance Between Slope Estimates
In a separate hypothetical study, a model predicts a symptom score from hours of sleep and hours of light exercise per day, with both predictors measured in hours. The fitted slopes are \(b_{\text{sleep}}=-1.20\) and \(b_{\text{exercise}}=-0.20\) symptom-score points per hour. Their standard errors are \(0.50\) and \(0.40\), and the estimated covariance is \(-0.080\). The model has \(df=48\). Assume the observations are independent and diagnostics support the stated regression assumptions.
Take the difference as sleep slope minus exercise slope:
The contrast standard error is
The test statistic for equal slopes is
With \(df=48\), the two-sided p-value is approximately \(0.193\). At \(\alpha=0.05\), there is not sufficient evidence that the two slopes differ. The negative estimated contrast says the sleep slope is one point per hour lower than the exercise slope in this fitted model. It does not establish that the population slopes are different. Because the coefficient covariance is negative, the contrast variance includes a positive contribution from subtracting twice that covariance.
Worked Example: Testing a Small Estimated Difference
A third hypothetical regression predicts a laboratory outcome, in measurement units, from two exposures measured in the same units. The estimated slopes are \(b_1=0.85\) and \(b_2=1.10\) outcome units per exposure unit. Their standard errors are \(0.22\) and \(0.25\), and their estimated covariance is \(0.030\). The residual degrees of freedom are \(60\). Assume the data and diagnostics satisfy the model conditions for this test.
The estimated contrast, in the stated order, is
Its standard error is
Therefore,
With \(df=60\), the two-sided p-value is approximately \(0.271\). At the 5% significance level, the result does not provide evidence that the slopes differ. The fitted slope for predictor 1 is lower by \(0.250\) outcome units per exposure unit, but this estimated difference is small relative to its standard error.
A Practical Testing Sequence
For a slope comparison, state the contrast and its order before calculating. Reversing the order changes the sign of the estimate and t statistic but not the two-sided p-value. The same sign convention should be used when describing which slope is larger.
Write, for example, \(\beta_1-\beta_2\), and identify the units in which the two slopes are being compared.
For equality, use \(H_0:\beta_1-\beta_2=0\). Choose a two-sided or directional alternative to match the research question.
Calculate \(b_1-b_2\) and the standard error using both coefficient variances and their covariance.
Divide the estimated contrast by its standard error under the null, use the full model’s residual degrees of freedom, and report the p-value in context.
Why Separate Coefficient Tests Are Not Enough
A common mistake is to compare the individual coefficient p-values: if one slope is “significant” and the other is not, conclude that the slopes differ. That reasoning is incorrect. Each individual test asks whether one slope differs from zero; neither tests whether the two slopes differ from each other. A coefficient can be estimated precisely enough to differ from zero while its difference from another coefficient remains uncertain. Conversely, both individual tests can be inconclusive while the difference is estimated precisely enough to stand out. Only the contrast test directly addresses equality.
Another mistake is to calculate the difference’s standard error as \(\sqrt{SE(b_1)^2+SE(b_2)^2}\) without checking covariance. That expression is correct only when the coefficient estimates have zero covariance. In a multiple regression, coefficient estimates from the same model are often correlated. Use their estimated covariance when calculating the uncertainty of their difference.
Check Your Understanding
Try these questions without looking back.
- Write the null hypothesis for testing whether \(\beta_2\) and \(\beta_4\) are equal.
- Why does the standard error of \(b_1-b_2\) include a covariance term?
- If a two-sided test of equal slopes has a large p-value, what conclusion is appropriate, and what conclusion is not justified?
- Why does finding one individually significant slope and one individually nonsignificant slope not establish that the slopes differ?
- What changes, and what stays the same, if the order of the contrast is reversed from \(b_1-b_2\) to \(b_2-b_1\)?