Why Releveling Changes Coefficients, Not Predictions
A factor such as plan type, region, or provider category is often represented in a generalized linear model by comparing each level with one selected reference category. The intercept and factor coefficients depend on that choice. Changing the reference category changes those reported coefficients, but it need not change the model’s fitted values.
The practical distinction is important: releveling changes how the same fitted relationships are expressed, not which relationships the model can represent. This tutorial derives the coefficient conversion and checks it in three hypothetical settings. The treatment of factors here is aligned with the SOA Exam PA (Predictive Analytics) syllabus.
Consider a factor \(F\) with \(K\) categories, numbered \(0,1,\ldots,K-1\). Suppose category 0 is the reference and the model contains this factor additively, along with other predictors collected in \(z_i\):
Here \(I(F_i=j)\) equals 1 when observation \(i\) is in category \(j\), and 0 otherwise. The vector \(z_i\) contains the other predictors, and \(\gamma\) contains their coefficients. Define \(\beta_0=0\) to represent the reference category’s factor effect. This additive model is the setting for the conversion below; when a model includes interactions involving the factor, their associated terms must also be re-expressed consistently.
The Releveling Formula
Suppose category \(r\) is to become the new reference. Its old factor effect was \(\beta_r\), where \(\beta_r=0\) if \(r=0\). To preserve each fitted linear predictor, add that effect to the intercept and subtract it from every other category’s effect.
The same result can be written for any category \(k\): its old factor contribution was \(\beta_k\), and its new contribution is \(\alpha^*-\alpha+\beta_k^*\). For \(k=r\), this is \(\beta_r+0=\beta_r\). For \(k\ne r\), it is \(\beta_r+(\beta_k-\beta_r)=\beta_k\). Thus the factor contribution is unchanged for every level. The other predictor contribution \(z_i^\mathsf{T}\gamma\) is also unchanged, so the complete \(\eta_i\) is unchanged.
This calculation is also a justification for prediction invariance. In a GLM, the fitted mean is obtained by applying the inverse link \(g^{-1}\) to the linear predictor: \(\mu_i=g^{-1}(\eta_i)\). If releveling leaves \(\eta_i\) unchanged, it leaves \(\mu_i\) unchanged. For a logistic model, for example, the fitted probability is determined by the unchanged \(\eta_i\); for a log-link model, the fitted mean is also determined by that same predictor.
The coefficient conversion is one-to-one: from the new parameters, the old intercept is \(\alpha=\alpha^*-\beta_r\), and each old factor effect is recovered by adding \(\beta_r\) to the corresponding new contrast. Consequently, this is a change of parameterization, not a change to the possible fitted linear predictors. If the model is refitted with the same data and specification but a different reference, its fitted values are therefore the same in exact arithmetic. Small numerical differences can occur from software tolerances.
Worked Examples
Worked Example: Releveling a Logistic Model
A hypothetical insurer models whether a submitted small-equipment claim is referred for review. Assume independent binary outcomes conditional on the predictors, with a binomial distribution and logit link. The fitted model uses service tier \(A\) as the reference:
Relevel the factor to make tier \(C\) the reference. Then compute the fitted referral probability for a tier \(B\) claim with tenure 10 years, using both parameterizations. Round the final probability to four decimals.
Method. The old factor effects are \(\beta_A=0\), \(\beta_B=0.50\), and \(\beta_C=1.00\). The new reference has old effect \(\beta_C=1.00\), so the new intercept is \(\alpha^*=-2.00+1.00=-1.00\). The new coefficient for \(A\) is \(\beta_A^*=0-1.00=-1.00\), and for \(B\) it is \(\beta_B^*=0.50-1.00=-0.50\). The tenure coefficient remains \(0.020\).
Check using the original model. For tier \(B\), the factor indicator for \(B\) is 1 and the one for \(C\) is 0. Tenure contributes \(0.020(10)=0.20\). Therefore \(\eta=-2.00+0.20+0.50=-1.30\), and \(p=1/(1+e^{1.30})\approx 0.2142\).
Check using the relevelled model. Tier \(B\) now has coefficient \(-0.50\), while tier \(C\) is the reference. Thus \(\eta^*=-1.00+0.20-0.50=-1.30\), giving \(p^*=1/(1+e^{1.30})\approx 0.2142\). The two calculations agree. The conversion avoids the common mistake of keeping the old intercept after changing the reference.
Worked Example: Releveling a Poisson Model With an Offset
A hypothetical transit agency models incident counts across service zones. Assume counts are conditionally independent Poisson variables, with a log link and an exposure offset. The model uses the Suburb zone as the reference:
where \(e_i\) is exposure in service-units and the coefficient of \(\log(e_i)\) is fixed at 1. Relevel to make Remote the reference. Then find the expected count for a Rural zone with exposure 5, using each parameterization.
Convert the coefficients. The old factor effect for Remote is \(\log(1.2)\). The new intercept, apart from the unchanged offset, is \(\log(2)+\log(1.2)=\log(2.4)\). The new Rural coefficient is \(\log(0.8)-\log(1.2)=\log(0.8/1.2)=\log(2/3)\). For completeness, the Urban coefficient becomes \(\log(1.5/1.2)=\log(1.25)\). The offset is not a factor contrast and remains \(\log(e_i)\).
Original parameterization. For Rural, the rate per service-unit is \(2(0.8)=1.6\). At exposure 5, the fitted mean count is \(\mu=5(1.6)=8\). Equivalently, its log mean is \(\log(5)+\log(2)+\log(0.8)=\log(8)\), so exponentiating gives 8.
Relevelled parameterization. The Rural rate is \(2.4(2/3)=1.6\), and the exposure is still 5. Hence \(\mu^*=5(2.4)(2/3)=5(1.6)=8\). The expected counts agree. This check also shows why the offset must be retained: removing it would change how exposure affects the fitted count, rather than merely changing the factor reference.
Worked Example: Releveling an Identity-Link Model
A hypothetical analyst models mean processing time in minutes by service tier and a centered workload score \(x\). Assume independent normally distributed outcomes with constant variance and an identity link. Tier \(L\) is the reference:
Make tier \(H\) the reference and verify the predicted mean for a tier \(M\) case with \(x=3\). Also identify the model’s implied mean for tier \(L\) at \(x=0\).
Convert the coefficients. The old effect for tier \(H\) is 80. The new intercept is \(120+80=200\). The new contrast for tier \(L\) is \(0-80=-80\), and the new contrast for tier \(M\) is \(35-80=-45\). The workload coefficient remains 4.
Tier \(M\) prediction from the original model. At \(x=3\), the workload contribution is \(4(3)=12\). Thus \(\mu=120+35+12=167\) minutes.
Tier \(M\) prediction from the new model. Tier \(M\)'s new contrast is \(-45\), so \(\mu^*=200-45+12=167\) minutes. For tier \(L\) at \(x=0\), the original model gives \(120\). The new model gives \(200-80=120\), as required. The common mistake is to interpret the new intercept, 200, as the mean for every case in the new reference category regardless of other predictors: it is the mean for tier \(H\) specifically when \(x=0\).
How to Check a Releveling
Set the old reference category’s factor effect to zero. Write down the effect for every other level from its coefficient.
Use the old effect of the newly selected reference, \(\beta_r\), to shift the intercept to \(\alpha+\beta_r\).
Subtract \(\beta_r\) from each other level’s old effect. Leave the other additive predictor coefficients unchanged.
Choose a factor level and predictor values, calculate \(\eta\) from both versions, and confirm equality before applying the inverse link.
A frequent exam trap is to subtract the new reference effect from the factor coefficients but forget to add it to the intercept. For example, in the logistic example, changing the reference from \(A\) to \(C\) but retaining the intercept \(-2.00\) would give the tier \(B\), 10-year case the incorrect predictor \(-2.00+0.20-0.50=-2.30\), rather than \(-1.30\). That would produce a different fitted probability, about \(0.0911\), falsely suggesting that releveling changed the model. The correction is to shift the intercept to \(-1.00\), which restores the predictor to \(-1.30\).
Releveling is useful when a different comparison is more relevant to a report or analysis. For example, comparing each plan with the most common plan may be convenient for one audience, while comparing each with a designated standard plan may be more useful for another. Coefficients and their direct interpretations change with the reference; fitted predictions from the same model do not. This invariance assumes the same observations, predictors, link, and model structure. Changing the data or specification is not simply releveling.
Check Your Understanding
For each problem, re-express the coefficients as requested and check the fitted result where asked.
- A hypothetical logistic model has factor levels \(X,Y,Z\), reference \(X\), intercept \(-0.60\), coefficients \(0.20\) for \(Y\) and \(0.90\) for \(Z\), and an unchanged additive predictor contribution of \(0.30\) for a specified case. Relevel to \(Y\). Give the new intercept, the new \(X\) and \(Z\) coefficients, and the specified case’s linear predictor when its factor is \(Z\). (Answer: intercept \(-0.40\), \(X=-0.20\), \(Z=0.70\), and \(\eta=-0.40+0.70+0.30=0.60\).)
- A Poisson log-link model has Suburb as reference, baseline rate \(1.5\) per exposure unit, West coefficient \(\log(4/3)\), and North coefficient \(\log(2/3)\). Relevel to West and calculate the expected count for North at exposure 6. (Answer: new baseline rate \(2\), North coefficient \(\log(1/2)\), and expected count \(6\cdot2\cdot(1/2)=6\).)
- An identity-link model has levels \(L,M,H\), reference \(L\), intercept 50, coefficients \(12\) for \(M\) and \(-8\) for \(H\), and an unchanged workload contribution \(3x\). Relevel to \(H\), then find the fitted mean for \(M\) when \(x=4\). (Answer: new intercept \(42\), \(L=8\), \(M=20\), and fitted mean \(42+20+3(4)=74\).)
- A logistic model has levels \(A,B,C\), reference \(A\), intercept \(-1.00\), coefficients \(0.40\) for \(B\) and \(-0.20\) for \(C\), and an additional predictor contribution of \(0.50\). Relevel to \(B\) and find the fitted probability for a \(C\) case with that predictor contribution. Round to four decimals. (Answer: new intercept \(-0.60\), \(A=-0.40\), \(C=-0.60\); \(\eta=-0.70\), so \(p=1/(1+e^{0.70})=0.3318\).)
- In an additive GLM with treatment-coded factor \(F\) and other predictors \(z\), a category with old effect \(\beta_r\) becomes the reference. State how the intercept, another category’s coefficient, and the coefficients of \(z\) change. (Answer: the intercept becomes \(\alpha+\beta_r\); another category \(j\) becomes \(\beta_j-\beta_r\); coefficients of \(z\) are unchanged.)