Why Test All Group Slopes Together?
When a quantitative predictor is related to an outcome in several categorical groups, a useful question is whether the fitted lines have a common slope. This is not the same as asking whether the groups have the same fitted outcomes: their intercepts can differ even when their slopes are equal. A joint test of the slopes asks whether allowing each group its own rate of change improves the model enough to provide evidence against a shared slope.
For example, a researcher might compare the association between hours of practice and a performance score across three training programs. The test concerns whether the score changes at the same rate per practice hour in all three programs. It does not, by itself, test whether the programs have the same average score at a particular number of practice hours.
Two Nested Models for Group-Specific Slopes
Suppose there are \(G\) groups, and \(Y_{ik}\) is the outcome for observation \(i\) in group \(k\), measured at quantitative predictor value \(x_{ik}\). A full model gives every group its own intercept and slope:
Here, \(\alpha_k\) is the intercept for group \(k\), \(\beta_k\) is its slope, and \(\varepsilon_{ik}\) is the error for that observation. A reduced model gives the groups separate intercepts but requires them to share one slope:
The reduced model is nested within the full model: it is obtained by imposing equality constraints on the full model’s slopes. Keeping group-specific intercepts in the reduced model is important. The question is whether slopes differ, not whether the groups’ lines are identical.
There are \(G-1\) independent restrictions in \(H_0\). For instance, with three groups, equality requires \(\beta_2-\beta_1=0\) and \(\beta_3-\beta_1=0\); the third possible pairwise equality follows from those two. Thus the test has \(q=G-1\) numerator degrees of freedom.
The Partial F-Test
Fit both models to the same outcome observations. Let \(SSE_R\) be the residual sum of squares from the reduced common-slope model, and let \(SSE_F\) be the residual sum of squares from the full group-specific-slope model. Because the full model contains the reduced model, \(SSE_F\) cannot be larger than \(SSE_R\). The full model uses \(q=G-1\) additional slope parameters.
When the full model has a separate intercept and slope for every group and there are \(n\) observations, it estimates \(2G\) parameters, provided the design has enough information to estimate them. In that case \(df_F=n-2G\). The reduced model estimates \(G+1\) parameters, so the difference in parameter counts is \(2G-(G+1)=G-1=q\). In other model parameterizations, calculate \(df_F\) from the fitted full model’s residual degrees of freedom.
The procedure assumes that the conditional mean is correctly represented by the chosen straight-line models, errors are independent with mean zero and a common variance, and the predictors and group labels are treated as fixed or conditioned upon. Normal errors are required for the exact finite-sample \(F\) reference distribution. Severe outliers, unequal error variances, dependence, or a poorly specified mean relationship can undermine the test. The two models must use the same observations; otherwise their residual sums of squares are not a valid nested-model comparison.
Why the Statistic Has This Form
The numerator measures the reduction in residual variation achieved by freeing the \(q\) slope constraints, expressed per restriction. The denominator estimates the error variance using the full model. Their ratio compares improvement attributable to allowing different slopes with the residual variation left unexplained by that more flexible model.
Under \(H_0\), both quantities estimate the same error variance, so their ratio should usually be near 1, apart from sampling variation. A large ratio means the reduction in residual sum of squares is large relative to the full model’s residual variation. The \(F\) distribution gives the upper-tail probability of seeing a ratio at least this large if the common-slope null hypothesis and model assumptions hold.
This is a partial test because it evaluates the slope restrictions after retaining the group intercepts and accounting for the other terms in the model. It is not a comparison of the full model with a model that omits all group information.
Worked Example: Three Programs and a Common Slope
Suppose a hypothetical data set contains \(n=30\) participants in three training programs. The outcome is a performance score, and the predictor is practice hours. The full model estimates a separate intercept and slope for each program. Assume that the same 30 observations are used in both fits, the straight-line form is reasonable over the observed practice-hour ranges, and residual checks support independence, approximately constant variance, and normality.
The full model has \(2G=6\) parameters, so \(df_F=30-6=24\). The reduced model retains three intercepts but has one common slope. Thus \(q=G-1=2\). Suppose the hypothetical fits give \(SSE_R=160\) and \(SSE_F=120\).
Calculate the statistic. The reduction in residual sum of squares is \(160-120=40\). Therefore,
The statistic is compared with an \(F\) distribution with 2 and 24 degrees of freedom. For \(F=4.00\), the upper-tail probability is
At significance level \(\alpha=0.05\), the p-value is below \(\alpha\), so reject \(H_0\). These hypothetical data provide evidence that the three program slopes are not all equal. The test does not identify which slopes differ, nor does it show that the programs caused different rates of change.
Interpreting the Result Carefully
The alternative is an “at least one differs” statement. A significant joint test does not establish that every pair of group slopes differs, and it does not say which group or groups account for the evidence. Follow-up comparisons, if needed, require their own estimates and uncertainty assessments. The earlier material on contrasts for comparing two group slopes addresses a particular pairwise comparison; the joint test here asks the broader question about all groups together.
A nonsignificant result is also limited. It means the data do not provide sufficient evidence against a common slope at the chosen significance level. It does not prove that the slopes are exactly equal. In particular, small samples, noisy outcomes, or limited overlap in the predictor values can make real slope differences difficult to detect. The estimated common-slope model may still be a convenient summary, but the test alone does not certify that it is an adequate approximation for every purpose.
Worked Example: A Nonsignificant Joint Test
Consider hypothetical data from three clinics, with \(n=24\) patients and a quantitative predictor measured in the same units in all clinics. The full model estimates six parameters, giving \(df_F=24-6=18\), while the common-slope model imposes \(q=2\) restrictions. Suppose \(SSE_F=72\) and \(SSE_R=78.7504\). Assume the same observations enter both models, the fitted straight-line mean is reasonable, and the residuals are independent with approximately constant variance and a distribution close enough to normal for the \(F\) reference distribution to be appropriate.
The full-model mean square error is \(72/18=4\), and the reduction in residual sum of squares is \(78.7504-72=6.7504\). Thus,
For \(F=0.8438\) with 2 and 18 degrees of freedom, the upper-tail p-value is approximately \(0.446\). At \(\alpha=0.05\), do not reject \(H_0\). These hypothetical results do not provide strong evidence that the clinic slopes differ. They do not demonstrate that all three population slopes are exactly equal.
Worked Example: Testing Four Groups From Model Output
A hypothetical analysis compares four groups using \(n=36\) observations. The fitted full model has one intercept and one slope per group, with residual sum of squares \(SSE_F=140\). The reduced model keeps four group intercepts but uses a common slope, and has \(SSE_R=200\). Suppose the observations are independent, the same 36 records are used in each fit, the linear mean form is suitable, and residual checks give no substantial indication of nonconstant variance or strong nonnormality.
Here \(G=4\), so the null imposes \(q=4-1=3\) restrictions. The full model estimates eight parameters, giving \(df_F=36-8=28\). Its mean square error is \(140/28=5\). The partial F statistic is
The test uses 3 and 28 degrees of freedom. An \(F\) table gives an upper-tail p-value below \(0.05\) for \(F=4.00\) with these degrees of freedom, so at the 5% significance level the joint null is rejected. The data provide evidence that the four group slopes are not all equal. This conclusion is not equivalent to saying all four slopes differ; additional comparisons would be needed to locate differences.
Common Mistakes and Practical Checks
- Forgetting to retain group intercepts. The reduced model for this question has separate group intercepts and one common slope. Constraining intercepts as well would test a different, broader set of hypotheses.
- Testing slopes one at a time instead of jointly. Separate tests do not directly provide the specified joint test of all \(G-1\) independent restrictions. The partial F test evaluates them together.
- Reversing the sums of squares. The numerator uses \(SSE_R-SSE_F\), which is nonnegative for correctly fitted nested models on the same observations. A negative value signals a fitting or comparison problem.
- Using the wrong denominator degrees of freedom. Use the full model’s residual degrees of freedom, not the reduced model’s. With \(n\) observations and \(2G\) estimable full-model parameters, it is \(n-2G\).
- Calling a nonsignificant result proof of equality. Failure to reject \(H_0\) is not proof that the population slopes match. The evidence may be inconclusive.
- Turning an association into a causal claim. Different fitted slopes describe different associations in the observed data. They do not, by themselves, establish that group membership causes the outcome to change at a different rate.
Check Your Understanding
Answer each question using the joint slope test described above.
- For five groups, how many independent restrictions are imposed by the null hypothesis that all group slopes are equal?
- Why should the reduced model retain separate intercepts for the groups?
- A full model has \(SSE_F=90\) and 20 residual degrees of freedom; a reduced model has \(SSE_R=120\). If there are three groups, calculate the partial F statistic.
- What does rejection of the joint null establish, and what does it not establish about the individual group slopes?
- Why can a p-value above \(\alpha=0.05\) not be interpreted as proof that the slopes are equal?