Why Change the Reference Category?
A reference category is the group against which the other categories’ fitted means are compared. Choosing a different reference changes the numerical values and interpretations of the intercept and indicator coefficients. It can make a particular comparison easier to read, such as comparing a new program with a standard program rather than with a control group.
The essential calculation is to start with the fitted mean for each group. The new intercept is the fitted mean for the newly selected reference group. Each new indicator coefficient is the fitted mean for that indicator’s group minus the fitted mean for the new reference group. This tutorial develops that translation for three categories.
The Three-Category Reference-Cell Model
Suppose a categorical predictor has three levels, A, B, and C, and the outcome \(Y\) is quantitative. Use A as the reference category and represent B and C with indicators. For observation \(i\), let \(I_{Bi}=1\) when the observation is in group B and \(0\) otherwise; define \(I_{Ci}\) in the same way for group C. The model is
Here \(\varepsilon_i\) is the model error. In this model, observations in A have both indicators equal to zero; observations in B have \(I_{Bi}=1\) and \(I_{Ci}=0\); observations in C have \(I_{Bi}=0\) and \(I_{Ci}=1\). The fitted values for the three groups are therefore
The hat marks estimated quantities. The intercept \(\hat{\beta}_0\) is the fitted mean for A. The coefficient \(\hat{\beta}_1\) is the fitted mean for B minus the fitted mean for A, and \(\hat{\beta}_2\) is the fitted mean for C minus the fitted mean for A. Each coefficient is measured in the outcome’s units.
The algebraic translation assumes that the categories are mutually exclusive and that the model includes an intercept and one indicator for each nonreference category. To interpret these fitted means as group means, the model’s mean structure must be appropriate for the setting. Standard regression assumptions about the errors, such as independence and constant variance, matter for usual uncertainty calculations; they are not needed to subtract fitted means or translate coefficients. The examples below concern this algebra, not tests or confidence intervals.
Deriving the New Coefficients
Change the reference category from A to B. The indicators in the new model are \(I_{Ai}\), equal to 1 for A and 0 otherwise, and \(I_{Ci}\), equal to 1 for C and 0 otherwise. Write the new model as
The asterisks distinguish the new coefficients from those in the original coding. When an observation is in B, both new indicators equal zero, so the new intercept must be the fitted mean for B. For an observation in A, the fitted value is the new intercept plus \(\hat{\beta}_A^{*}\); for C, it is the new intercept plus \(\hat{\beta}_C^{*}\). Matching these expressions to the original fitted means gives
The signs and subtractions follow from the direction of comparison: each indicator coefficient is “its group minus the reference group.” For instance, with B as reference, the coefficient for A is A minus B, not B minus A.
Worked Example: Changing the Baseline from A to B
Suppose a hypothetical study compares a control group (A), a brief-training group (B), and an extended-training group (C). The outcome is a task score in points. A fitted model using A as the reference has \(\hat{\beta}_0=72\), \(\hat{\beta}_1=5\), and \(\hat{\beta}_2=9\). Translate its coefficients to use B as the reference.
Check the setup. The three named groups are mutually exclusive categories, and the model has an intercept plus indicators for B and C. We are given fitted coefficients from that model. The group-mean calculations below require no error-distribution assumption; interpreting the model inferentially would require suitable regression assumptions.
First calculate the fitted means under the original reference:
With B as the new reference, the intercept is B’s fitted mean, 77 points. The A indicator coefficient is A minus B, and the C indicator coefficient is C minus B:
Thus the recoded intercept is 77 points, the fitted mean for brief training. The A coefficient is \(-5\) points, meaning the control group’s fitted score is 5 points lower than the brief-training group’s fitted score. The C coefficient is \(4\) points, meaning the extended-training group’s fitted score is 4 points higher than the brief-training group’s fitted score. These are model-based group comparisons, not evidence that training caused score differences.
Calculating from Fitted Means Directly
The original coefficients are not required if the fitted means for all three groups are already known. Let the fitted means be \(\hat{\mu}_A\), \(\hat{\mu}_B\), and \(\hat{\mu}_C\). With B as reference, place \(\hat{\mu}_B\) in the intercept position, then subtract it from each nonreference group’s fitted mean. In symbols,
This route is often easier to audit because every coefficient is visibly a difference between two fitted means. It also prevents a common sign error: write the comparison in words first, then subtract in that order.
Worked Example: Re-Expressing Three Fitted Means
Suppose a hypothetical clinic is comparing three appointment systems, labeled A, B, and C. The fitted mean waiting times are 18, 14, and 11 minutes, respectively. Express the model with C as the reference category.
Check the setup. Each appointment system is one of the three mutually exclusive groups, and the supplied values are fitted group means from a model with a separate mean for each group. The recoding calculation uses only these means; no claim about independence or error variance is needed to perform it.
With C as reference, the intercept is the fitted mean for C, which is 11 minutes. The A and B indicator coefficients compare their fitted means with C:
The new intercept is 11 minutes. The coefficient for A is 7 minutes, so A’s fitted mean waiting time is 7 minutes greater than C’s. The coefficient for B is 3 minutes, so B’s fitted mean is 3 minutes greater than C’s. Since waiting time is the outcome, positive differences mean longer fitted waits.
Changing to the Third Category
The same rule applies whichever group becomes the reference. Starting with A as reference and changing to C makes the intercept \(\hat{\mu}_C\). The new A coefficient is A minus C, and the new B coefficient is B minus C. In terms of the original coefficients, these are
Notice that the new intercept is not generally the old intercept: it is now the fitted mean of C. Likewise, the new coefficients are not copied unchanged from the original model. They must be differences from C, which can reverse signs or subtract one original coefficient from another.
Worked Example: Changing from A to C
A hypothetical program evaluation records a numerical assessment score for participants in three program formats. With format A as reference, the fitted model has \(\hat{\beta}_0=64\), \(\hat{\beta}_1=-3\) for B, and \(\hat{\beta}_2=6\) for C. Find the coefficients when C is the reference.
Check the setup. The formats are treated as mutually exclusive categories, and the stated coefficients come from the three-category indicator model. We are translating fitted group means only; the example provides no basis for assessing the model’s error assumptions or making a causal conclusion.
First recover the three fitted means:
With C as the reference, the intercept is 70 points. The new A and B coefficients are each group mean minus 70:
The intercept is the fitted assessment score for format C. The A coefficient of \(-6\) points says that A’s fitted mean is 6 points below C’s; the B coefficient of \(-9\) points says B’s fitted mean is 9 points below C’s. The formula gives the same arithmetic directly: \(-\hat{\beta}_2=-6\), and \(\hat{\beta}_1-\hat{\beta}_2=-3-6=-9\).
A Reliable Calculation Method
For a three-category factor, use the following sequence whenever the reference category changes. The algebra is short, but writing the group means first makes the direction of every comparison explicit.
For A as the original reference, calculate \(\hat{\mu}_A=\hat{\beta}_0\), \(\hat{\mu}_B=\hat{\beta}_0+\hat{\beta}_1\), and \(\hat{\mu}_C=\hat{\beta}_0+\hat{\beta}_2\).
For example, if B is now the reference, the new intercept must equal \(\hat{\mu}_B\).
With B as reference, calculate A minus B and C minus B. Attach the appropriate group labels to the resulting indicator coefficients.
State the reference group for the intercept and describe each indicator coefficient as a fitted mean difference, including its direction and outcome units.
A quick arithmetic check is to reconstruct each group mean from the new intercept and its coefficient. For example, under B reference, the implied fitted values are the intercept for B, the intercept plus the A coefficient for A, and the intercept plus the C coefficient for C. The resulting values should match the group means used in the translation. This is a check on the coefficient arithmetic, not a separate statistical test.
Common Mistakes
- Keeping the old intercept. The new intercept is the fitted mean for the newly selected reference group, not automatically the old reference mean.
- Reversing a comparison. With B as reference, the A coefficient is A minus B. If the subtraction is written B minus A, its sign will be wrong.
- Copying an old indicator coefficient. A coefficient from the original model compares its group with A. A coefficient in the recoded model compares its group with the new reference and may require a subtraction of two original coefficients.
- Forgetting the outcome units. If the outcome is waiting time in minutes, the intercept and differences are in minutes, not in group labels or indicator units.
- Calling a fitted difference a causal effect. Recoding changes the comparison used to describe the model; it does not by itself establish that group membership caused the outcome difference.
Check Your Understanding
For each question, state the calculation and interpret the result in context where appropriate.
- A model uses A as reference, with \(\hat{\beta}_0=50\), \(\hat{\beta}_1=8\) for B, and \(\hat{\beta}_2=3\) for C. Find the intercept and indicator coefficients if B becomes the reference.
- Three fitted group means are 120, 126, and 117 dollars for A, B, and C. Write the intercept and indicator coefficients with A as the reference.
- With A as reference, the original coefficients are \(\hat{\beta}_1=-4\) for B and \(\hat{\beta}_2=7\) for C. What is the new coefficient for B if C becomes the reference? Explain the subtraction.
- A learner says that changing the reference to C leaves the intercept equal to the fitted mean for A because A was the original reference. Identify the error and give the correct rule.
- If an outcome is measured in hours, what are the units of a reference-cell intercept and of an indicator coefficient? What comparison does that coefficient describe?