Tutorials › Exam PA - Predictive Analytics › Releveling Factors Without Changing Predictions

Exam PA · Coefficient Interpretation and Diagnostics · Tutorial 337 of 966

Releveling Factors Without Changing Predictions

Re-express factor coefficients under a new reference category and verify that the model’s fitted predictions are preserved.

Intermediate 10 min read

What You'll Learn

  • Write the fitted linear predictor for a factor using treatment coding
  • Convert the intercept and factor contrasts when changing the reference category
  • Keep other additive predictor terms unchanged during releveling
  • Verify prediction invariance for logistic, Poisson, and identity-link models
  • Recognize why releveling changes coefficient interpretations but not the fitted model

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.

Definition: Under treatment coding, one factor level is chosen as the reference. The intercept describes the linear predictor for that level when other numeric predictors are zero, and each other level has a coefficient equal to its difference from the reference on the model’s link scale. A fitted linear predictor is denoted by \(\eta_i\), with \(\eta_i=g(\mu_i)\), where \(g\) is the link function and \(\mu_i\) is the fitted mean.

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\):

$$ \eta_i=\alpha+\sum_{j=1}^{K-1}\beta_j I(F_i=j)+z_i^\mathsf{T}\gamma. $$

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.

Result: With category \(r\) as the new reference, the converted intercept and factor coefficients are
$$ \alpha^*=\alpha+\beta_r, \qquad \beta_j^*=\beta_j-\beta_r\quad (j\ne r), \qquad \beta_r^*=0. $$
The coefficients \(\gamma\) of the other additive predictors are unchanged.

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:

$$ \eta=-2.00+0.020(\text{tenure in years}) +0.50I(F=B)+1.00I(F=C), \qquad p=\frac{1}{1+e^{-\eta}}. $$

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:

$$ \log(\mu_i)=\log(e_i)+\log(2) +\log(1.5)I(F_i=\text{Urban}) +\log(0.8)I(F_i=\text{Rural}) +\log(1.2)I(F_i=\text{Remote}), $$

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:

$$ \mu=120+35I(F=M)+80I(F=H)+4x. $$

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

1
Record the old factor effects.
Set the old reference category’s factor effect to zero. Write down the effect for every other level from its coefficient.
2
Choose the new reference effect.
Use the old effect of the newly selected reference, \(\beta_r\), to shift the intercept to \(\alpha+\beta_r\).
3
Convert each remaining contrast.
Subtract \(\beta_r\) from each other level’s old effect. Leave the other additive predictor coefficients unchanged.
4
Verify a fitted case.
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.

Key takeaway: Under additive treatment coding, set the new intercept to the old intercept plus the old effect of the new reference. Subtract that effect from every other factor contrast. This preserves every linear predictor, and therefore every fitted response.

Check Your Understanding

For each problem, re-express the coefficients as requested and check the fitted result where asked.

  1. 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\).)
  2. 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\).)
  3. 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\).)
  4. 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\).)
  5. 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.)
Clinical Biostats