Why Change the Reference Group?
A regression model with a categorical group and a quantitative predictor can describe a separate fitted line for each group. The reference group determines which line is represented directly by the baseline coefficients; the other groups’ coefficients describe differences from that baseline. Choosing a different reference group changes those coefficient values and interpretations, but it need not change any fitted line.
This distinction matters when a different group makes the comparisons easier to communicate. For example, a study may initially use Group A as the reference, but readers may be more interested in how Groups A and C compare with Group B. Re-expressing the model makes B the baseline without refitting a different relationship or altering its predictions.
The Model and What Its Coefficients Mean
Suppose there are \(K\) groups and a quantitative predictor \(x\). With group \(A\) as the reference, use an indicator \(I_{ig}\) equal to 1 when observation \(i\) belongs to group \(g\), and 0 otherwise. The model with group-specific intercepts and slopes can be written as:
Here, \(\beta_0\) is the fitted intercept for group A, and \(\beta_1\) is its fitted slope. For another group \(g\), \(\delta_g\) is its intercept difference from A and \(\gamma_g\) is its slope difference from A. Thus that group’s fitted line has intercept \(\beta_0+\delta_g\) and slope \(\beta_1+\gamma_g\).
The model assumes that the conditional mean outcome is linear in \(x\) within each group. If using the usual OLS standard errors and tests, we also rely on the relevant error assumptions, such as independent errors with mean zero; the conventional standard-error formulas additionally assume constant error variance. Changing the reference group is an algebraic re-expression of the same model. It does not itself make these modeling assumptions true or false.
How the Coefficients Transform
For each group \(g\), let its fitted line have intercept \(a_g\) and slope \(b_g\), so its fitted outcome at \(x\) is \(a_g+b_gx\). Under reference group A, \(a_A=\beta_0\) and \(b_A=\beta_1\). For every other group, \(a_g=\beta_0+\delta_g\) and \(b_g=\beta_1+\gamma_g\).
Now choose group B as the reference. Its line must become the new baseline. The new baseline intercept and slope are therefore \(a_B=\beta_0+\delta_B\) and \(b_B=\beta_1+\gamma_B\). For any group \(g\) other than B, its new intercept difference is \(a_g-a_B\), and its new slope difference is \(b_g-b_B\). Substitution gives:
For group A itself, take \(\delta_A=0\) and \(\gamma_A=0\). Its differences from B are then \(-\delta_B\) and \(-\gamma_B\). These expressions describe the same group lines in a different coordinate system: the reference line changes, and every other line is now compared with it.
Worked Examples
Worked Example: Changing the Reference in a Three-Group Model
Suppose a hypothetical analysis of outcome \(Y\) against predictor \(x\) gives the following fitted lines with Group A as the reference:
Thus \(\delta_B=5\), \(\gamma_B=-0.5\), \(\delta_C=-3\), and \(\gamma_C=1.25\). The hypothetical data are assumed to support approximately linear trends within each group over a common observed range of \(x\), with no major departures evident in diagnostic plots; the observations are assumed independent for the stated regression analysis.
Make Group B the reference. Its baseline coefficients are its own intercept and slope: \(12+5=17\) and \(2-0.5=1.5\). Group A’s new intercept difference is \(0-5=-5\), and its slope difference is \(0-(-0.5)=0.5\). Group C’s new intercept difference is \(-3-5=-8\), and its slope difference is \(1.25-(-0.5)=1.75\). The re-expressed model is therefore:
Check the fitted outcomes at \(x=4\). The original lines give \(12+2(4)=20\) for A, \(17+1.5(4)=23\) for B, and \(9+3.25(4)=22\) for C. The new model gives B’s baseline value \(17+1.5(4)=23\); for A it gives \(23-5+0.5(4)=20\); and for C it gives \(23-8+1.75(4)=22\). The predictions agree group by group.
Worked Example: Reversing a Two-Group Comparison
In a hypothetical analysis, the fitted lines are \(\hat{Y}=8+3x\) for Group A and \(\hat{Y}=11+2x\) for Group B. The predictor has a roughly linear relationship with the outcome in each group over the observed range, and the model’s observations are assumed independent. With A as reference, B’s intercept difference is \(11-8=3\), and its slope difference is \(2-3=-1\).
If B becomes the reference, its baseline line is \(11+2x\). A’s intercept difference from B is \(8-11=-3\), and its slope difference from B is \(3-2=1\). The model becomes:
At \(x=6\), the original lines give \(8+3(6)=26\) for A and \(11+2(6)=23\) for B. The new model gives \(23-3+1(6)=26\) for A and \(23\) for B. The changed coefficient signs reflect reversing the comparison, not a changed outcome pattern.
Worked Example: Interpreting a Slope Contrast After Re-Referencing
Suppose a hypothetical three-group model estimates slopes of 2.0 for A, 2.5 for B, and 3.2 outcome units per predictor unit for C. The group-specific relationships are assumed adequately represented by straight lines over the range being compared, and observations are assumed independent for the regression inference.
With A as reference, the estimated slope interaction for C is \(3.2-2.0=1.2\). It says that C’s fitted outcome changes 1.2 units more per one-unit increase in \(x\) than A’s fitted outcome does. If C becomes the reference, the slope difference for A is \(2.0-3.2=-1.2\). The numerical coefficient changes sign because the comparison has been reversed; the two group slopes remain 2.0 and 3.2.
For illustration, suppose the standard error of this particular slope contrast is 0.4. Testing whether the C-minus-A slope difference is zero gives \(t=1.2/0.4=3\). Expressed as the A-minus-C difference, the estimate is \(-1.2\), its standard error is still 0.4, and \(t=-1.2/0.4=-3\). A two-sided test of the same contrast has the same evidence and p-value, because the sign changes but the magnitude of the test statistic does not.
Why Fitted Lines and Predictions Stay the Same
A direct justification comes from the group-specific line. Before changing the reference, group \(g\) has fitted value \(a_g+b_gx\). After changing the reference to B, the model gives B’s baseline \(a_B+b_Bx\), plus the group’s differences \((a_g-a_B)+(b_g-b_B)x\). Adding these terms yields:
The expression is exactly the original fitted line for group \(g\). Because this equality holds for every group and every \(x\), it also holds at every observed predictor value. Consequently, with the same model structure and data, the re-expression preserves fitted values, residuals, and the residual sum of squares. The parameters are different descriptions of the same set of group-specific lines.
This equivalence depends on retaining the same model structure. In particular, the model must allow the same group-specific intercepts and slopes before and after the change. A reference switch is not a reason to add or remove an interaction term, alter the predictor, or change which observations are included.
What Changes, and What Does Not
The baseline intercept and slope change because they now describe a different group. The non-reference coefficients also change because they express differences from a different baseline. Therefore, a statement such as “the interaction coefficient is 1.2” is incomplete unless it identifies which two groups’ slopes are being compared and in which direction.
The actual group lines and their predictions do not change. Nor does a test of the same group contrast, provided it is expressed correctly after re-referencing. For example, changing a contrast from “C minus A” to “A minus C” reverses its estimate and test-statistic sign, but preserves its standard error and two-sided p-value. A coefficient test tied to the new baseline may instead ask a different question: it compares a different pair of groups.
This is useful when presenting results. Choose the reference group that makes the comparisons of interest easiest to read, then state each coefficient’s comparison explicitly. The reference choice affects the language of the coefficients, not the underlying fitted relationship.
Common Mistake
- Wrong reasoning: “The interaction coefficient changed after the reference group changed, so the model now predicts a different slope for this group.”
- Correction: A changed coefficient may be a different difference between slopes. Recover the group’s slope by adding the baseline slope and its slope difference, or compare the group-specific line directly. Re-referencing changes how the lines are encoded, not the lines themselves.
- Another error: Treating the new baseline slope as a universal slope for all groups. In a model with group-by-predictor interaction, the baseline slope belongs only to the reference group; other groups have their own slope differences.
Check Your Understanding
Answer each question by referring to group-specific intercepts, slopes, or their differences.
- With Group A as reference, the baseline slope is 4 and Group B’s slope difference is \(-1.5\). What are the fitted slopes for A and B?
- If B becomes the reference in Question 1, what is A’s slope difference from B?
- Why does changing the reference group not change a fitted value at a particular \(x\)?
- A coefficient changes from 0.8 to \(-0.8\) after reversing the order of a two-group slope comparison. What has changed, and what has not?
- Why should an interaction coefficient be described together with the groups being compared?