Tutorials › Introduction to Statistics › Choosing and Interpreting Reference Categories

Introduction to Multiple Regression · Tutorial 929 of 996

Choosing and Interpreting Reference Categories

See how to interpret category comparisons from a regression equation and translate them correctly when a different category becomes the reference.

Intermediate 10 min read

What You'll Learn

  • Interpret the intercept and indicator coefficients using the reference category.
  • Translate regression coefficients when the reference category changes.
  • Verify that changing the reference leaves fitted category means unchanged.
  • Choose a reference that makes comparisons useful and clear.
  • Distinguish a change in coefficient wording from a change in the underlying model.

Why the Reference Category Matters

A categorical predictor with several levels can be represented in a regression model using one fewer indicator variables than levels. The category left out of the indicators is the reference category. It is not omitted from the analysis: it is built into the intercept. Each indicator coefficient then describes how the expected response in one category differs from the expected response in the reference category.

The reference category affects the numbers and wording of the coefficients, but not the comparisons the model can represent. Changing the reference changes which category is the baseline for those comparisons. It does not, by itself, change the fitted mean for any category.

Definition: For a categorical predictor with \(k\) levels, a reference-category coding selects one level as the reference and uses \(k-1\) indicator variables for the others. An indicator is 1 for observations in its named category and 0 otherwise. In a model containing only this categorical predictor, the intercept is the expected response in the reference category, and each indicator coefficient is the difference between the expected response in that indicator's category and the expected response in the reference category.

Model and Interpretation

Suppose \(G\) is a categorical predictor with levels \(A,B,\ldots\), and the response \(Y\) is quantitative. If \(A\) is the reference category, define \(D_{ig}=1\) when observation \(i\) is in category \(g\), and \(D_{ig}=0\) otherwise. A model using \(A\) as reference is

$$ Y_i=\beta_0+\sum_{g\ne A}\beta_gD_{ig}+\epsilon_i. $$

Here \(\beta_0\) is the model's mean response for category \(A\), and \(\beta_g\) is the difference between the model's mean response for category \(g\) and that for \(A\). For an observation in \(A\), every indicator is 0, so its model mean is \(\beta_0\). For an observation in \(g\ne A\), its indicator is 1 and the others are 0, so its model mean is \(\beta_0+\beta_g\).

The model describes category-specific means. Its basic assumptions for this interpretation are that each observation belongs to exactly one of the listed categories, the response is quantitative, and the conditional mean in each category is represented by the model. For the usual least-squares estimates to match the observed category means, each category must have observations. Independence and error-variance assumptions become important for certain forms of inference, but are not needed to understand how the coefficient coding works.

With this model, least squares estimates each category mean using that category's sample mean. Thus the estimated intercept is the reference category's sample mean, and an estimated indicator coefficient is the corresponding category's sample mean minus the reference category's sample mean. This gives a direct way to check a regression equation against group summaries.

Worked Example: Interpreting Three Category Means

In a hypothetical assessment, scores are recorded for students using one of three study formats. The sample mean score is 72 points for Format A, 78 points for Format B, and 69 points for Format C. Treat format as the only predictor and use Format A as the reference. Interpret the fitted coefficients.

The intercept is the mean for the reference category:

$$ \hat\beta_0=72\text{ points}. $$

The Format B coefficient is the difference between its mean and Format A's mean:

$$ \hat\beta_B=78-72=6\text{ points}. $$

The Format C coefficient is likewise:

$$ \hat\beta_C=69-72=-3\text{ points}. $$

The fitted equation is \(\hat{Y}=72+6D_B-3D_C\). For Format A, both indicators are 0 and the fitted mean is 72 points. For Format B, \(D_B=1\) and \(D_C=0\), giving \(72+6=78\) points. For Format C, the fitted mean is \(72-3=69\) points. The positive coefficient for B says its sample mean is 6 points higher than A's; the negative coefficient for C says its sample mean is 3 points lower than A's. These are comparisons of means, not evidence that study format caused the score differences.

Changing the Reference Category

A different reference category changes the baseline of each comparison. To see the translation precisely, suppose the original reference is \(A\). Write \(\hat\beta_0^{(A)}\) for its fitted intercept and \(\hat\beta_g^{(A)}\) for the fitted coefficient for category \(g\). The fitted mean for each category is then

$$ \hat\mu_A=\hat\beta_0^{(A)},\qquad \hat\mu_g=\hat\beta_0^{(A)}+\hat\beta_g^{(A)}\quad(g\ne A). $$

Now choose category \(B\) as the reference. The new intercept must equal the fitted mean for \(B\). A coefficient for any other category must be that category's fitted mean minus \(B\)'s fitted mean. Substituting the expressions above gives the recoding rules:

$$ \hat\beta_0^{(B)}=\hat\beta_0^{(A)}+\hat\beta_B^{(A)},\qquad \hat\beta_A^{(B)}=-\hat\beta_B^{(A)},\qquad \hat\beta_g^{(B)}=\hat\beta_g^{(A)}-\hat\beta_B^{(A)} \quad(g\ne A,B). $$

The first equation makes the new intercept equal to the old fitted mean for \(B\). For category \(A\), its difference from \(B\) is the negative of \(B\)'s difference from \(A\). For any other category \(g\), subtracting \(B\)'s difference from \(A\) from \(g\)'s difference from \(A\) leaves the difference between \(g\) and \(B\).

Key result: Changing the reference category changes the intercept and indicator coefficients according to the new baseline. It does not change any fitted category mean: each new intercept-plus-indicator combination still equals the same estimated mean for its category.

Worked Example: Re-expressing the Same Model

Use the three hypothetical study-format means from the previous example, but now make Format C the reference. Starting from the Format A reference equation, the intercept becomes Format C's fitted mean:

$$ \hat\beta_0^{(C)}=72+(-3)=69\text{ points}. $$

The new Format A coefficient is the difference between A and C, which is the negative of the old C coefficient:

$$ \hat\beta_A^{(C)}=-(-3)=3\text{ points}. $$

The new Format B coefficient is its old difference from A minus C's old difference from A:

$$ \hat\beta_B^{(C)}=6-(-3)=9\text{ points}. $$

The new equation is \(\hat{Y}=69+3D_A+9D_B\). For A it gives \(69+3=72\) points; for B it gives \(69+9=78\) points; and for C, whose indicators are both 0, it gives 69 points. The numerical coefficients have changed, but the fitted means have not. The B coefficient now compares B with C, so it is 9 points rather than the 6-point comparison with A.

Why the Fitted Means Stay the Same

This invariance follows from the indicator coding itself. With a reference category, the model assigns one fitted mean to each category: the intercept for the reference and the intercept plus the relevant coefficient for every other category. Re-referencing simply writes those same category means as differences from a different baseline.

The least-squares fitting also makes this clear. If category \(g\) has \(n_g\) observations, its contribution to the sum of squared residuals is minimized by setting its fitted mean equal to its sample mean. For a proposed fitted mean \(m_g\), the within-category sum of squares can be decomposed as follows:

$$ \sum_{i:G_i=g}(Y_i-m_g)^2 = \sum_{i:G_i=g}(Y_i-\bar{x}_g)^2+n_g(\bar{x}_g-m_g)^2, $$

where \(\bar{x}_g\) denotes the sample mean of the response in category \(g\). The cross-product term vanishes because the deviations from that category's sample mean sum to zero. The first term does not depend on \(m_g\); the second is nonnegative and is smallest when \(m_g=\bar{x}_g\). Since this applies separately to every category, the least-squares fitted category means are the sample category means regardless of which one is used as the reference.

Worked Example: Checking Coefficients From Raw Data

Suppose hypothetical completion times, in minutes, are recorded for people using three service options: Option X has times 8, 10, and 12; Option Y has times 11, 13, and 12; Option Z has times 7, 8, and 9. Use Option Y as the reference and calculate the fitted coefficients.

First calculate each category's sample mean:

$$ \bar{x}_X=\frac{8+10+12}{3}=10,\qquad \bar{x}_Y=\frac{11+13+12}{3}=12,\qquad \bar{x}_Z=\frac{7+8+9}{3}=8\text{ minutes}. $$

The intercept is the Option Y mean, 12 minutes. The Option X coefficient is \(10-12=-2\) minutes, and the Option Z coefficient is \(8-12=-4\) minutes. Thus the fitted equation is \(\hat{Y}=12-2D_X-4D_Z\). It predicts 10 minutes for X, 12 minutes for Y, and 8 minutes for Z.

If Option Z is instead the reference, the intercept is 8 minutes. The coefficient for X is \(10-8=2\) minutes, and the coefficient for Y is \(12-8=4\) minutes. The predictions remain 10, 12, and 8 minutes for X, Y, and Z. Each coefficient is expressed in minutes because the response is a completion time measured in minutes.

Choosing a Useful Reference

Any category can serve as the reference as long as the coding is applied consistently. A useful reference is often the category that gives the clearest interpretation for the question at hand: a standard option, a usual practice, a control condition, or a naturally meaningful baseline. It may also be useful to choose a category that readers can readily recognize. The largest category is not automatically the best choice; sample size affects precision, but it does not determine which comparison is most meaningful.

The choice changes the questions answered directly by individual coefficients. With a reference category, each coefficient compares one other category with that reference. If the question concerns two non-reference categories, their difference can still be obtained by subtracting their coefficients. For example, with \(A\) as reference, the fitted mean difference between \(B\) and \(C\) is \(\hat\beta_B^{(A)}-\hat\beta_C^{(A)}\). Selecting B as the reference would instead report that same comparison directly as the coefficient for C, with the sign reversed if the order of comparison is reversed.

Worked Example: Matching the Baseline to a Question

A hypothetical service evaluation reports mean waiting times of 14 minutes for the standard process, 11 minutes for a revised process, and 17 minutes for a specialist process. The question of interest is how each alternative compares with the standard process, so use the standard process as the reference.

The intercept is 14 minutes. The revised-process coefficient is \(11-14=-3\) minutes, and the specialist-process coefficient is \(17-14=3\) minutes. In context, the observed mean waiting time for the revised process is 3 minutes lower than the standard-process mean; the observed mean for the specialist process is 3 minutes higher. This choice makes both requested comparisons explicit. The result describes group means and does not establish that the process caused the differences.

If the main question instead compared the revised process directly with the specialist process, choosing the revised process as reference would report the specialist comparison as \(17-11=6\) minutes. Alternatively, from the standard-reference coefficients, the same difference is \(3-(-3)=6\) minutes. Choosing a reference can make a desired comparison easier to read, but it does not create new information.

Common Mistakes

  • Calling the reference category absent. Its indicator is not included, but its observations remain in the model. They are represented by the intercept.
  • Interpreting an indicator coefficient as an absolute mean. With a reference category, a coefficient is a difference from the reference mean. Add it to the intercept to recover the fitted mean for that category.
  • Keeping the old interpretation after re-referencing. A coefficient always compares its named category with the current reference, not with whichever category served as the reference before.
  • Assuming new coefficients mean a new fit. Re-referencing changes the coordinate description of the same category means. Check by computing the intercept plus the relevant coefficient for each category.
  • Using causal wording for a mean difference. A regression comparison alone does not show that category membership caused a response difference.
Key takeaway: Read the intercept as the fitted mean for the reference category and each indicator coefficient as a difference from that category. When the reference changes, recompute every comparison from the category means; the fitted mean for each category remains unchanged.

Check Your Understanding

Try these questions using the interpretation and recoding rules from this tutorial.

  1. A categorical predictor has three levels with fitted means 20, 25, and 18 units. If the first level is the reference, what are the intercept and the two indicator coefficients?
  2. In a model with category A as reference, the coefficient for B is 4 and the coefficient for C is \(-2\). What is the fitted mean difference between B and C?
  3. Why does changing the reference category not change the fitted mean for each category?
  4. What does a coefficient of \(-5\) mean when it is attached to category D and category B is the reference?
  5. Give one reason to choose a particular category as the reference, and explain why having the largest sample size is not required for that choice.