Why Reparameterize a Factor?
A categorical predictor with several levels can be represented using treatment coding: choose one level as the reference, then describe each other level by its difference from that reference on the model’s linear-predictor scale. Changing the reference changes the coefficient values, but it need not change the model’s fitted values. This distinction matters when a different comparison is more useful for interpretation, or when reviewing a model whose reference level has been changed.
The transformation is an algebraic re-expression of the same model, not a new fit with different information. To verify that the re-expression is correct, compare the linear predictor for every factor level before and after the change. In a generalized linear model, equal linear predictors imply equal fitted means because both use the same inverse link.
The Transformation
First consider a model with one factor and no other predictors. Write the old linear predictor for level \(k\) as \(\eta_k\). The values implied by the old treatment-coded coefficients are
Now choose a different level \(s\) as the reference. In the new coding, the intercept must represent level \(s\), and the coefficient for any non-reference level \(j\) must represent its difference from level \(s\). Therefore,
This is the general rule. Substituting the old treatment-coded predictors gives a convenient formula for converting the coefficients directly. Assume \(s\ne r\). The old predictor for \(s\) is \(\beta_0+\beta_s\), so the new intercept is \(\beta_0+\beta_s\). The old reference \(r\) had predictor \(\beta_0\), so its new contrast is \(\beta_0-(\beta_0+\beta_s)=-\beta_s\). For any other level \(j\), its new contrast is \((\beta_0+\beta_j)-(\beta_0+\beta_s)=\beta_j-\beta_s\).
The coefficient for the new reference \(s\) is not included in the new model: its contrast is zero by definition. If the reference is not changed, the coefficients remain as they were.
Why the Transformation Works
The key requirement is that the new coefficients reproduce the old predictor at each level. For the new reference level \(s\), the new predictor is \(\alpha_0=\eta_s\). For any other level \(j\), it is \(\alpha_0+\alpha_j\). By the transformation rule,
Thus the new predictor equals the old predictor for level \(s\) and for every other level \(j\). In a generalized linear model, if \(\mu_k=g^{-1}(\eta_k)\), equality of the predictors gives \(g^{-1}(\eta_k)\) unchanged. The fitted mean is therefore preserved even when the link is nonlinear. The coefficient values themselves can change substantially without changing any fitted value.
The same reasoning applies when the model also contains numeric predictors that enter additively and do not interact with the factor. At a fixed value of those predictors, their contribution is the same in both parameterizations; the factor intercept and contrasts shift as above, so the full predictor remains equal. This tutorial concerns that additive setting. Models with interactions require additional coefficient transformations and should not be handled by changing only the factor coefficients.
For the old reference, use the intercept; for each other level, add its old treatment coefficient.
Use the old predictor for the level that will become the new reference.
Subtract the old predictor for the new reference from the old predictor for that level.
Reconstruct each predictor using the new coefficients and confirm it matches the old one.
Worked Examples
Worked Example: Changing the Reference in a Linear Model
A hypothetical service team models an average review score using a three-level service channel factor. A fitted linear model has the original reference level Web, with intercept \(12\), contrast \(3\) for Phone, and contrast \(-2\) for Branch. Change the reference to Phone, find the transformed coefficients, and check all three fitted scores.
Method. First calculate each level’s old linear predictor: Web has \(12\); Phone has \(12+3=15\); Branch has \(12+(-2)=10\). The new intercept must equal the old Phone predictor, so it is \(15\).
The new Web contrast is its old predictor minus the old Phone predictor: \(12-15=-3\). The new Branch contrast is \(10-15=-5\). The new reference, Phone, has no contrast.
Check. Under the new coding, Phone has predictor \(15\), Web has \(15+(-3)=12\), and Branch has \(15+(-5)=10\). Each equals its old predictor.
The transformed model is therefore an intercept of \(15\), a Web contrast of \(-3\), and a Branch contrast of \(-5\), with Phone as reference. The method avoids the common mistake of merely reversing the Phone contrast’s sign while leaving the other coefficient values unchanged.
Worked Example: Preserving Logistic-Regression Probabilities
A hypothetical insurer models whether a submitted item requires additional review, using a Bernoulli response and a logistic regression with only a three-level submission-type factor. With Routine as reference, the fitted intercept is \(-2\), the Priority contrast is \(0.8\), and the Batch contrast is \(-0.4\). Change the reference to Batch and verify the fitted probabilities for all three types. Use the logit link, \(g(p)=\log\{p/(1-p)\}\).
Method. The old linear predictors are Routine: \(-2\); Priority: \(-2+0.8=-1.2\); and Batch: \(-2-0.4=-2.4\). The new intercept is the old Batch predictor, \(-2.4\). The new Routine contrast is \(-2-(-2.4)=0.4\), and the new Priority contrast is \(-1.2-(-2.4)=1.2\).
The old and new predictors agree level by level. Convert each predictor to a probability using \(p=1/(1+\exp(-\eta))\). For Routine, \(p=1/(1+\exp(2))\approx0.1192\). For Priority, \(p=1/(1+\exp(1.2))\approx0.2315\). For Batch, \(p=1/(1+\exp(2.4))\approx0.0832\). The probabilities are rounded to four decimal places.
Check. With Batch as reference, the predictors are Batch: \(-2.4\), Routine: \(-2.4+0.4=-2\), and Priority: \(-2.4+1.2=-1.2\). These are exactly the old predictors, so applying the same inverse-logit gives the same probabilities. The transformation avoids treating a contrast as a probability difference: these coefficients are differences in log odds, not in probabilities.
Worked Example: Changing the Reference With an Additive Numeric Predictor
A hypothetical count model uses a Poisson response with a log link. It models the expected number of events as a function of a numeric workload value \(x\) and a three-level equipment category. The original reference is Basic; the fitted intercept is \(0.2\), the workload coefficient is \(0.1\), the Enhanced contrast is \(0.5\), and the Compact contrast is \(-0.3\). Change the reference to Enhanced. Then compare fitted means at \(x=2\) for all categories, with exposure \(e=2\) included as an offset \(\log(e)\).
Model and method. The conditional count is modeled as Poisson with mean \(\mu\), and \(\log(\mu)=\log(e)+\eta\), where \(\eta\) contains the intercept, workload term, and category effect. The reference change affects only the intercept and category contrasts: the workload coefficient and offset remain unchanged.
The old category predictors, excluding the shared workload and offset terms, are Basic: \(0.2\); Enhanced: \(0.2+0.5=0.7\); and Compact: \(0.2-0.3=-0.1\). Thus the new intercept is \(0.7\). The new Basic contrast is \(0.2-0.7=-0.5\), and the new Compact contrast is \(-0.1-0.7=-0.8\). The workload coefficient remains \(0.1\).
At \(x=2\) and \(e=2\), the shared contribution is \(\log(2)+0.1(2)=\log(2)+0.2\). The old log means are Basic: \(\log(2)+0.2+0.2=\log(2)+0.4\); Enhanced: \(\log(2)+0.2+0.7=\log(2)+0.9\); and Compact: \(\log(2)+0.2-0.1=\log(2)+0.1\).
Under the new coding, the corresponding log means are Enhanced: \(\log(2)+0.2+0.7=\log(2)+0.9\); Basic: \(\log(2)+0.2+0.7-0.5=\log(2)+0.4\); and Compact: \(\log(2)+0.2+0.7-0.8=\log(2)+0.1\). The fitted means are therefore \(2\exp(0.4)\approx2.9836\) for Basic, \(2\exp(0.9)\approx4.9192\) for Enhanced, and \(2\exp(0.1)\approx2.2103\) for Compact. These means are rounded to four decimal places and match under both parameterizations.
The check avoids two errors: changing the numeric slope even though it is shared across categories, and dropping the exposure offset while comparing predictions.
Common Mistake and Limits
A frequent error is to change the intercept to the new reference’s predictor but adjust only the coefficient for the old reference. Every remaining contrast must also be recalculated relative to the new reference. For example, in the linear example, changing the intercept from \(12\) to \(15\) and changing only the Web contrast to \(-3\), while leaving the Branch contrast at \(-2\), would predict \(15+(-2)=13\) for Branch. The correct old Branch predictor is \(10\), so the correct new Branch contrast is \(-5\).
The transformations above assume an intercept and treatment coding for one factor in an additive model. They re-express fitted level effects; they do not establish that the model is appropriate, that estimates are precise, or that the factor has a causal effect. If a factor level is absent from the data, its effect may not be estimable from that fit. For models that include interactions, do not apply the simple additive transformation to only the factor’s main-effect coefficients: the full set of terms must be considered to preserve predictions.
Check Your Understanding
For each problem, identify the transformed coefficients and check the stated prediction property.
- A linear model has levels Cedar, Maple, and Pine, with Cedar as reference, intercept \(7\), Maple contrast \(2\), and Pine contrast \(-1\). Change the reference to Pine. Give the new intercept and the Cedar and Maple contrasts. (Answer: Intercept \(6\); Cedar contrast \(1\); Maple contrast \(3\).)
- A logistic model has reference level A, intercept \(-1\), and contrasts B \(=0.6\) and C \(=-0.2\). Change the reference to B. Give the new intercept and the contrasts for A and C. (Answer: Intercept \(-0.4\); A contrast \(-0.6\); C contrast \(-0.8\).)
- A Poisson log-link model has reference Small, intercept \(0.3\), numeric slope \(-0.05\), and contrasts Medium \(=0.4\) and Large \(=0.9\). Change the reference to Large. State the new intercept, the Small and Medium contrasts, and the numeric slope. (Answer: Intercept \(1.2\); Small contrast \(-0.9\); Medium contrast \(-0.5\); numeric slope remains \(-0.05\).)
- A linear model has old reference A, intercept \(10\), and contrasts B \(=-3\) and C \(=5\). A proposed change to reference C uses intercept \(15\), B contrast \(-8\), and A contrast \(-5\). Check the three level predictors and state whether the reparameterization is valid. (Answer: Valid; A predicts \(15-5=10\), B predicts \(15-8=7\), and C predicts \(15\), matching the old predictors \(10\), \(10-3=7\), and \(10+5=15\).)