Why the Reference Category Matters
A categorical predictor with several levels is often represented using treatment coding: one level is the reference, and the model estimates coefficients for the other levels relative to it. The fitted model can describe the same categories whichever level is chosen, but the coefficients answer different questions. Choosing a reference deliberately can make the model output directly useful for a pricing, service, or operational comparison.
The choice is about interpretation, not about making the model fit better. If the model is otherwise unchanged, changing only the reference does not change fitted predictions. It changes which category is represented by the intercept and which pairwise differences appear directly as individual coefficients.
What the Reference Makes Easy to Read
Suppose a factor has levels \(A\), \(B\), and \(C\), and \(A\) is the reference. In a model with no other predictors, treatment coding gives the linear predictor \(\eta_A=\beta_0\), \(\eta_B=\beta_0+\beta_B\), and \(\eta_C=\beta_0+\beta_C\). Thus, \(\beta_0\) corresponds to \(A\), while \(\beta_B\) and \(\beta_C\) are differences from \(A\). The precise interpretation depends on the link function.
For a linear model with an identity link, the coefficients are differences in the conditional mean of the response. For a logistic regression model with a logit link, they are differences in log odds; exponentiating a coefficient gives an odds ratio against the reference. A coefficient is not automatically a difference in probabilities in a logistic model.
Choose a reference by first stating the comparison that matters. If the question is “How does each other category compare with the standard option?”, make the standard option the reference. If the important question is “How does the new service compare with the existing service?”, the existing service is a natural baseline. A common or substantively meaningful category may be convenient, but the best choice is the one that makes the intended comparison clear and adequately supported by the data.
Why the Fitted Predictions Stay the Same
The reason can be seen directly from the treatment-coded linear predictors. Let \(r\) be the old reference, and let \(s\) be a different reference. Write \(\eta_j\) for the linear predictor for category \(j\). Under treatment coding, the coefficient for category \(j\) relative to \(r\) is \(\eta_j-\eta_r\). If \(s\) becomes the reference, the new intercept is \(\eta_s\), and the new coefficient for \(j\) is \(\eta_j-\eta_s\). These values preserve every category’s linear predictor.
For the new reference itself, the indicator contribution is zero, so its linear predictor is \(\eta_s\). For every other category, the new intercept plus its new coefficient adds back to the same \(\eta_j\) as before. Since a model’s fitted mean is obtained by applying the inverse link to its linear predictor, an unchanged \(\eta_j\) means an unchanged fitted mean. This argument assumes that only the reference coding changes: the observations, predictors, model terms, and fitted model structure remain the same.
Write down which two categories a reader needs to compare, and in which direction.
Use one of the categories in that comparison as the reference, often the existing, standard, or policy-relevant option.
Read a linear-model coefficient as a mean difference, or a logistic coefficient as a log-odds difference. Do not substitute one interpretation for the other.
Confirm that changing the reference has not changed the model terms or category-specific fitted values.
Worked Examples
Worked Example: Making a Direct Cost Comparison
A hypothetical service organization models the mean administrative cost per case by service tier. The model is an additive Gaussian linear model with identity link: \(Y=\beta_0+\) tier effect \(+\varepsilon\), where the errors are independent with \(\varepsilon\sim N(0,20^2)\). No interest rate or mortality assumption applies to this cost model. The fitted treatment-coded coefficients use Routine as the reference: intercept \(120\), Expedited coefficient \(35\), and Specialist coefficient \(-10\), all in dollars. The analyst’s main comparison is Specialist versus Expedited. Choose a reference that makes that comparison direct, and give the fitted mean for each tier.
Method. The current coefficients compare each non-reference tier with Routine. To make Specialist versus Expedited direct, use Expedited as the reference. The desired difference is Specialist mean minus Expedited mean.
Step 1: Calculate the original fitted means. Routine is the reference, so its fitted mean is \(120\). Expedited has fitted mean \(120+35=155\). Specialist has fitted mean \(120+(-10)=110\).
Step 2: Calculate the direct comparison. Specialist minus Expedited is \(110-155=-45\) dollars. Specialist’s fitted mean is therefore \(45\) dollars lower than Expedited’s.
Step 3: Express the model with Expedited as reference. The new intercept is the Expedited mean, \(155\). The Routine coefficient is \(120-155=-35\). The Specialist coefficient is \(110-155=-45\).
Check. With the new coding, the fitted means are Expedited \(=155\), Routine \(=155-35=120\), and Specialist \(=155-45=110\), exactly as before. The common mistake is to report \(-10\) as the Specialist-versus-Expedited difference; it is actually Specialist versus Routine.
Worked Example: Choosing a Baseline in Logistic Regression
A hypothetical insurer models whether a customer renews a policy, using a categorical contact channel with levels Web, Agent, and Branch. The response is Bernoulli conditional on channel, and the fitted model is logistic regression with no other predictors: \(\operatorname{logit}(p)=\log(p/(1-p))\). The fitted intercept is \(-1.0\) for Web, with Agent coefficient \(0.4\) and Branch coefficient \(0.9\). Assume independent Bernoulli outcomes conditional on channel. No interest rate or mortality assumption applies. The analyst wants the Branch-versus-Agent odds ratio. Re-express the model using Agent as reference and check the fitted probabilities.
Method. Under a logit link, a coefficient is a log-odds difference. The odds ratio for one category versus another is the exponential of the corresponding log-odds difference.
Step 1: Calculate the category linear predictors. Web has \(\eta=-1.0\). Agent has \(\eta=-1.0+0.4=-0.6\). Branch has \(\eta=-1.0+0.9=-0.1\).
Step 2: Rebase on Agent. The new intercept is Agent’s linear predictor, \(-0.6\). Web’s coefficient is \(-1.0-(-0.6)=-0.4\). Branch’s coefficient is \(-0.1-(-0.6)=0.5\). Thus the Branch-versus-Agent odds ratio is \(\exp(0.5)\approx1.6487\).
Step 3: Check the fitted probabilities. The inverse-logit function is \(p=1/(1+\exp(-\eta))\). For Web, \(p=1/(1+\exp(1))\approx0.2689\). For Agent, \(p=1/(1+\exp(0.6))\approx0.3543\). For Branch, \(p=1/(1+\exp(0.1))\approx0.4750\). Probabilities are rounded to four decimals.
Check. The Branch-versus-Agent odds ratio is also \(\exp(0.9-0.4)=\exp(0.5)\approx1.6487\). The re-expressed linear predictors remain \(-1.0\), \(-0.6\), and \(-0.1\), so the probabilities are unchanged. A common mistake is to exponentiate \(0.9\) and call it the Branch-versus-Agent odds ratio; \(0.9\) compares Branch with Web.
Worked Example: Interpreting a Log-Link Model
A hypothetical claims team models positive claim-handling cost by plan tier. Assume a Gamma generalized linear model with log link, conditional mean \(\mu\), and variance \(\phi\mu^2\), with \(\phi=0.25\). Observations are independent conditional on tier. There are no other predictors. With Standard as reference, the intercept is \(\log(300)\), the Premium coefficient is \(\log(1.2)\), and the Economy coefficient is \(\log(0.8)\); costs are in dollars. No interest rate or mortality assumption applies. The intended comparison is Economy versus Premium. Give the direct log-scale coefficient and the fitted mean for each tier.
Method. With a log link, exponentiating a category coefficient gives a ratio of conditional means against the reference. A difference between two category coefficients gives the log ratio for that pair.
Step 1: Find the fitted means using Standard as reference. Standard has mean \(\exp(\log(300))=300\). Premium has mean \(\exp(\log(300)+\log(1.2))=300(1.2)=360\). Economy has mean \(\exp(\log(300)+\log(0.8))=300(0.8)=240\).
Step 2: Calculate the requested comparison. The Economy-versus-Premium log-mean difference is \(\log(0.8)-\log(1.2)=\log(2/3)\approx-0.4055\). Its exponent is \(2/3\approx0.6667\): Economy’s fitted mean is two-thirds of Premium’s, or \(120\) dollars lower.
Step 3: Express the model with Premium as reference. The new intercept is \(\log(360)\). The Standard coefficient is \(\log(300)-\log(360)=\log(5/6)\), and the Economy coefficient is \(\log(240)-\log(360)=\log(2/3)\). The new Economy coefficient directly gives the requested comparison.
Check. Applying the inverse link gives Premium \(360\), Standard \(360(5/6)=300\), and Economy \(360(2/3)=240\). These match the original fitted means. The common mistake is to treat \(\log(0.8)\) as Economy versus Premium; it compares Economy with Standard.
Practical Choices and Common Traps
A reference category is most useful when it answers a comparison stakeholders actually need. In R, for an unordered factor using treatment contrasts, a reference can be set with a call such as relevel(plan, ref = "Standard") before fitting the model. The selected label must match a level of the factor. Refit the model after changing the reference, then verify that the model uses the intended factor and that the comparison is being read on the correct scale.
Changing the reference does not create new information. A rare category can still produce an unstable estimate, and choosing it as the reference does not fix sparse data. Also, coefficient estimates and their standard errors are attached to particular comparisons. A coefficient’s p-value tests that parameter’s comparison against zero; after changing the reference, the corresponding individual coefficient tests a different comparison. Do not infer that the underlying category predictions changed merely because a coefficient or its p-value now looks different.
- Wrong baseline for the question. A coefficient against the default reference may not answer the business comparison being asked.
- Wrong scale. In logistic regression, \(\beta\) is a log-odds difference and \(\exp(\beta)\) is an odds ratio, not a probability difference.
- Wrong direction. Category \(B\) versus \(A\) has the opposite signed difference from \(A\) versus \(B\). For an odds or mean ratio, reversing the comparison takes the reciprocal.
- Confusing coefficient changes with prediction changes. With only a reference change, the intercept and coefficients are re-expressed, while each category’s linear predictor and fitted mean remain the same.
Check Your Understanding
For each problem, identify what the coefficient compares and check the implied fitted values or ratio.
- A Gaussian linear model for mean repair cost has fitted means of \(80\) dollars for Basic, \(95\) for Plus, and \(110\) for Select. With Plus as reference, what are the Basic and Select coefficients, and what is Select minus Basic? (Answer: Basic \(-\$15\), Select \(+\$15\); Select minus Basic \(=\$30\).)
- A logistic model uses Email as reference, with a Phone coefficient of \(-0.3\) and a Mail coefficient of \(0.2\). What is the Phone-versus-Mail log-odds difference and odds ratio? (Answer: \(-0.5\); \(\exp(-0.5)\approx0.6065\).)
- A log-link model has fitted means of \(500\) dollars for Core, \(600\) for Flex, and \(400\) for Saver. If Flex becomes the reference, what is the Saver coefficient and its mean ratio? (Answer: \(\log(400/600)=\log(2/3)\approx-0.4055\); ratio \(2/3\approx0.6667\).)
- A logistic model has Old-plan linear predictor \(-0.8\), New-plan predictor \(-0.2\), and Retiree-plan predictor \(0.1\). With New plan as reference, give the Old and Retiree coefficients and verify the Old-plan fitted probability to four decimals. (Answer: Old \(-0.6\), Retiree \(0.3\); Old probability \(1/(1+\exp(0.8))\approx0.3100\).)
- A linear model gives coefficients of \(12\) for North and \(-5\) for South, with West as reference. What is North minus South, and what would the South coefficient be if North became the reference? (Answer: North minus South \(=12-(-5)=17\); South relative to North \(=-5-12=-17\).)