I read John Fox's book "Regression diagnostics: An introduction". In Chapter 2, he gave an example which I quoted below:

... if $y$ is income, $x$ is education in years, and $g$ is the factor gender, with levels male, female, and nonbinary, coding the dummy regressors $d_f = 1$ for females and 0 otherwise, and $d_m = 1$ for males and 0 otherwise,

the model $y = \beta_o + \beta_1x + \beta_2d_f + \beta_3d_m + \epsilon$ assumes the same education slope for all three genders but potentially different intercepts.

Below is what I do not understand:

Why does this model have the "same slope" but "different intercepts"? I thought their slopes are different with different betas ($\beta_1, \beta_2, \beta_3$). On the contrary, the intercept is the same ($\beta_0$). Anyway, why the intercept can be different (there is only one variable $\beta_0$)?

  • 3
    $\begingroup$ You’ll learn so much by graphing this. Pick several education-income pairs for males to plot in one color and several education-income pairs to plot for females in a different color. (I mean the income predicted by the regression.) $\endgroup$
    – Dave
    Commented Feb 19, 2022 at 12:05
  • 1
    $\begingroup$ The education slope is $\beta_1$. The intercept in a plot of $y$ versus $x$ is the value of $y$ when $x=0$ $$\begin{array}{}y(x=0) &=& \beta_o + \beta_1 \cdot 0 + \beta_2 d_f + \beta_3d_m\\ &= &\beta_o + \beta_2 d_f + \beta_3d_m \end{array}$$ and the intercept will be different for different $d_f$ and $d_m$. You are right that from a different perspective these $\beta_2$ and $\beta_3$ are slope parameters instead of intercept. But in a plot of y versus x they play a role as varying intercept. $\endgroup$ Commented Feb 19, 2022 at 12:45
  • $\begingroup$ This is a plot of the pulse of cricket songs vs. temperature for two species of cricket. The two lines have the same slope but different intercepts: rcompanion.org/rcompanion/images/e_04_01.jpg. (Original data can be found at: www.biostathandbook.com/ancova.html $\endgroup$ Commented Feb 19, 2022 at 12:51
  • 1
    $\begingroup$ But you are right that for the overall model, there is one intercept. The intercepts of the covariate lines get taken into account in the betas for the dummy regressors. For me anyway, this is difficult to visualize, but will make perfect sense if you fit the ancova model, and then do the math to plot the lines for the covariates. $\endgroup$ Commented Feb 19, 2022 at 12:56
  • $\begingroup$ @SextusEmpiricus Thanks! "... in a plot of y versus x they play a role as varying intercept" really clear my mind! $\endgroup$
    – T X
    Commented Feb 20, 2022 at 14:18

1 Answer 1


For a male person, the equation is $$y=\beta_1x + (\beta_0+\beta_3)+\epsilon$$ and for a female person, the equation is $$y=\beta_1x + (\beta_0+\beta_2)+\epsilon$$

These two equations have the same education slope and potentially different intercepts as described in the text.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.