Regression is one of the most powerful and popular methods in statistics. It is used to describe the relationship between a response variable and one or more explanatory variables. A common regression problem involves modelling data containing groups of observations, where the model parameters (i.e., the intercept and slope for simple linear regression) may vary between the groups.
A few weeks ago, a question was posed on the Genstat Discussion List: For simple linear regression with groups, why do we first allow for different intercepts and then for different slopes?
The user had observed that when performing a simple linear regression analysis on grouped data, Genstat began by fitting a model with a common intercept and slope for each of the groups, followed by a model with different intercepts but a common slope, and then finally by a model with different intercepts and different slopes.

Common intercepts, common slopes![]() Single line |
When fitting a simple linear regression model with groups in Genstat, the first step is to fit a model with common intercepts and slopes. This results in a single regression line for the entire dataset. This initial model provides a baseline for comparison. |
Different intercepts, common slopes![]() Parallel lines |
The second step involves fitting a model with different intercepts but a common slope. That is, each group is allowed to have its own intercept, representing a vertical shift in the regression line’s position. However, the slopes across the groups remain the same, resulting in parallel lines. By introducing variation in intercepts, we can examine how the overall level of the response variable differs between the groups. |
Different intercepts, different slopes![]() Separate lines |
Finally, Genstat fits a model with different intercepts and different slopes, resulting in separate regression lines for each group. Â By allowing both the intercepts and slopes to vary, we can study and compare the relationship between the response variable and the explanatory variable(s) for each of the different groups. |
Why does Genstat allow for different intercepts before allowing for different slopes?
The rationale behind this order lies in the assumption that the different groups are more likely to influence the general level of the response variable rather than solely modifying the slope. Indeed, it is far more common to observe a group affecting the general level of the response variable than just the relationship with the explanatory variable. Therefore, it is sensible to prioritize testing of different intercepts, whilst keeping the slope common across groups, before testing for different slopes. This choice aligns with the notion that the different groups may exhibit distinct baseline levels but share a similar relationship between the response and explanatory variables.
Furthermore, models with separate slopes and a common intercept will not have a common intercept if the explanatory variable is changed by the addition of a constant. The intercept is the height of the line when the explanatory variable is zero, so the common intercept model only makes sense if the zero point for the explanatory variable has a physical interpretation. To demonstrate, let’s consider a simple dataset with two groups, where the two groups have a common intercept (in this case zero) but different slopes.
![]() |
![]() |
Now, observe how the intercepts change when we add a constant, in this example 3, to the explanatory variable, x. Although the slopes are unchanged, the intercepts have changed, and are no longer the same for both groups.
![]() |
![]() |
Finally, Genstat’s chosen order of allowing the intercepts to vary, and then the slopes, offers an important advantage with respect to comparing the different regression models that result. As the models are nested, a single accumulated analysis of variance table can be created, and this concise summary facilitates comparison and interpretation of the different models.
What if the data look like the groups have the same intercept?
Genstat does allow you to fit the models with a common intercept, but you will need to specify the model using the General linear regression menu dialog. The model would then be given as x + x.group rather than x + group (separate intercepts, common slope) or x*group (separate intercepts and slopes, which can also be written as x + group + x.group).

Adding group to this model with the Change model button will provide a test of the differences in the intercepts when the slopes are different.
But what about models with zero intercepts?
In traditional regression analysis, fitting a model without an intercept is generally not recommended. However, there is a widely accepted exception: when the physical mechanism behind the model implies a zero intercept. In such cases, it is acceptable to specify a zero intercept while estimating varying slopes. (This exception can be extended to allow for the estimation of varying slopes with a specified (i.e., fixed) non-zero intercept.)
Conclusion
The order in which Genstat fits separate intercepts and slopes in the Regression menu for grouped data follows a logical progression, starting with a model that assumes common intercepts and slopes, and gradually introducing variation in the intercepts and then in the slopes.
Related blogs
- Pearson Correlation vs Simple Linear Regression
- Deciding which variables matter: exploring multiple linear regression in Genstat
- Extending linear models to accommodate non-Normal data and random effects: LM → GLM → GLMM → HGLM
About the authors
Dr. David Baird
Dr. David Baird is an experienced biometrician with 40 years’ experience in applying statistics to agriculture, horticulture, biosecurity, entomology, ecology, plant breeding and finance. He has been an author of Genstat for 27 years developing the spreadsheet, statistical menus, client interface and graphics and has contributed over 80 Genstat procedures in areas of data manipulation, experimental design, probability distributions, model fitting, data mining and microarrays.






