Why Sum-to-Zero Coding Changes the Interpretation
A categorical rating factor can be represented in a GLM using a reference level or using effects constrained to sum to zero. Both parameterizations can produce the same fitted values, but their coefficients answer different questions. Under sum-to-zero coding, each level’s coefficient describes its departure from the factor’s grand mean on the model’s linear-predictor scale. It is not, in general, a comparison with a designated reference level.
For a log-link model, the distinction matters in rate-making: the intercept becomes a geometric-mean level on the response scale, and exponentiated coefficients are relativities to that geometric mean. This geometric mean is ordinarily unweighted across the factor’s levels, not an average weighted by the portfolio’s exposures or claim counts.
This definition treats the \(\beta_j\) as the actual level effects, including the effect implied for any level not explicitly represented by a software contrast column. A sum-to-zero implementation may display only \(K-1\) contrast coefficients; the omitted level’s effect is determined by the constraint. Interpret the implied level effects, not just the printed coefficient labels.
From the Linear Predictor to a Grand-Mean Relativity
Assume a GLM with a log link, a positive modeled mean, and one categorical factor. For now, suppose there are no other predictors or offsets. The model is
where \(\mu_j\) is the fitted mean response for level \(j\). Exponentiating gives \(\mu_j=\exp(\alpha)\exp(\beta_j)\). Thus \(\exp(\alpha)\) is the level mean when the factor effect is zero, and \(\exp(\beta_j)\) is level \(j\)’s multiplicative relativity to that centered level.
The zero-effect level need not be an actual category. The centering constraint gives \(\alpha\) a precise interpretation even when no category has \(\beta_j=0\): it is the average of the level-specific log means.
Therefore, \(\exp(\alpha)\) is the unweighted geometric mean of the \(K\) fitted level means. Similarly, the relativities multiply to one:
Their geometric mean is one. This does not imply that their arithmetic mean is one. Nor does it imply that the exposure-weighted average of the fitted rates equals \(\exp(\alpha)\). Those are different summaries.
Worked Examples
Worked Example: Reading Relativities Around the Grand Mean
A hypothetical rating model has three territory levels and a log link. Its fitted annual rates are $50, $100, and $200. Find the intercept and each sum-to-zero effect, then interpret the effects. Check whether the intercept rate is the arithmetic average of the three fitted rates.
Method. Under the stated log-link model, calculate the average of the level-specific log rates. The sum-to-zero effects are each level’s log rate minus that average.
Step 1: Calculate the geometric mean rate. The product of the rates is \(50\times100\times200=1{,}000{,}000\). Its cube root is \(100\), since \(100^3=1{,}000{,}000\). Therefore \(\exp(\alpha)=100\), and \(\alpha=\log(100)\).
Step 2: Calculate the level effects. For the first territory, \(\beta_1=\log(50)-\log(100)=\log(0.5)\). For the second, \(\beta_2=\log(100)-\log(100)=0\). For the third, \(\beta_3=\log(200)-\log(100)=\log(2)\).
Step 3: Check the constraint. The sum is \(\log(0.5)+0+\log(2)=\log(1)=0\), as required.
The fitted relativities are \(0.5\), \(1\), and \(2\): each is relative to the geometric-mean rate of $100. The arithmetic average rate is \((50+100+200)/3=350/3=\$116.67\), not $100.
Check and common mistake. The fitted means reconstructed from the model are \(100(0.5)=\$50\), \(100(1)=\$100\), and \(100(2)=\$200\), matching the data. Using $116.67 as the intercept would confuse an arithmetic average of rates with the geometric mean implied by averaging log rates.
Worked Example: Recovering Level Rates From Sum-to-Zero Coefficients
A hypothetical log-link model for claim cost per exposure unit has intercept \(\alpha=\log(120)\). For three vehicle classes, the effects are \(\beta_1=\log(0.75)\), \(\beta_2=0\), and \(\beta_3=\log(4/3)\). Find the fitted cost for each class and verify the centering interpretation.
Method. Exponentiate the intercept to obtain the grand-mean rate, exponentiate each effect to obtain its relativity, and multiply the two.
Step 1: Verify the constraint. Since \(0.75\times1\times(4/3)=1\), the sum of the log effects is \(\log(1)=0\).
Step 2: Calculate fitted costs. Class 1 has rate \(120(0.75)=\$90\). Class 2 has rate \(120(1)=\$120\). Class 3 has rate \(120(4/3)=\$160\).
Step 3: Check the grand mean. The product of the fitted costs is \(90\times120\times160=1{,}728{,}000\). Its cube root is \(120\), because \(120^3=1{,}728{,}000\). Thus the intercept rate is the geometric mean of the three level costs.
Check and common mistake. The level relativities multiply to one, and the fitted costs reproduce the stated rates. The arithmetic average is \((90+120+160)/3=\$123.33\), so interpreting the intercept rate as that arithmetic average would be incorrect.
Worked Example: Converting Reference Comparisons to Sum-to-Zero Effects
A hypothetical three-level log-link model uses level C as the treatment-coded reference. Its fitted rates are $120 for A, $180 for B, and $150 for C. Convert the treatment comparisons into a sum-to-zero intercept and level effects. Report the sum-to-zero relativities to four decimals.
Method. First express each rate as a ratio to the reference rate. Then divide each of those ratios by their geometric mean to center the effects at a product of one.
Step 1: Find the treatment-coded ratios. Relative to C, the ratios are \(120/150=0.8\), \(180/150=1.2\), and \(150/150=1\). Their product is \(0.8\times1.2\times1=0.96\).
Step 2: Find the centering factor. The geometric mean of those ratios is \(g=(0.96)^{1/3}\), approximately \(0.9864848\). The sum-to-zero intercept rate is \(150g\), approximately $147.97. Its log is the average of the three log fitted rates.
Step 3: Center each effect. The sum-to-zero relativities are \(0.8/g\), \(1.2/g\), and \(1/g\), approximately \(0.8110\), \(1.2164\), and \(1.0137\), respectively. Their product is one because their numerator product is \(0.96\) and their denominator product is \(g^3=0.96\). The corresponding effects are the logs of these three relativities, so their sum is zero.
Step 4: Reconstruct and check the fitted rates. The centered intercept rate multiplied by each centered relativity gives \(150(0.8)=\$120\), \(150(1.2)=\$180\), and \(150(1)=\$150\). Centering has changed the parameter interpretation, not the fitted rates.
Common mistake. Treating the treatment ratios \(0.8\), \(1.2\), and \(1\) as sum-to-zero relativities is wrong: their product is \(0.96\), not one. The correction is to divide each by their geometric mean.
Why the Centering Formula Holds
The central result follows directly from the model equations, rather than from any special property of the fitting algorithm. Suppose the \(K\) level-specific linear predictors are \(\eta_j=\alpha+\beta_j\), with \(\sum_j\beta_j=0\). Sum the predictors across all levels:
Dividing by \(K\) yields \(\alpha=(1/K)\sum_j\eta_j\). If the link is logarithmic, then \(\eta_j=\log(\mu_j)\). Exponentiating the average log mean gives the geometric mean, because \(\exp((1/K)\sum_j\log(\mu_j))=(\prod_j\mu_j)^{1/K}\). This proves both the grand-mean interpretation and its dependence on the log scale.
The argument assumes the stated unweighted constraint across the \(K\) levels. A different, explicitly weighted constraint, such as \(\sum_j w_j\beta_j=0\) with positive weights \(w_j\), centers the linear predictors at their weighted average using normalized weights \(w_j/\sum_jw_j\). It then gives a weighted geometric mean under a log link. Do not assume that weights are present merely because some levels have more exposure.
How This Differs From Treatment Coding
With treatment coding, one level is designated as the reference and assigned effect zero. The intercept is the linear predictor for that reference level, and each other coefficient is a difference from it on the linear-predictor scale. With sum-to-zero coding, no level is selected as the reference; the intercept is the average linear predictor across levels, and each effect is a deviation from that average.
The two approaches can describe identical fitted values. For example, if treatment-coded log-rate ratios relative to a reference are \(\gamma_1,\ldots,\gamma_K\), with \(\gamma_r=0\) for reference level \(r\), then the average treatment-coded level predictor is \(\alpha_T+(1/K)\sum_j\gamma_j\). This is the sum-to-zero intercept. Each centered effect is \(\gamma_j-(1/K)\sum_m\gamma_m\). These transformations preserve every level predictor while changing the point from which deviations are measured.
| Feature | Sum-to-zero coding | Treatment coding |
|---|---|---|
| Constraint or anchor | Level effects sum to zero | Reference-level effect is zero |
| Intercept on the linear-predictor scale | Unweighted average of level predictors | Predictor for the reference level |
| Coefficient interpretation | Deviation from the factor grand mean | Difference from the reference level |
| Log-link interpretation | Relativity to geometric-mean level response | Relativity to reference-level response |
When a model contains other factors or continuous predictors, the same centering logic applies to the categorical factor while the other predictors are held fixed. The intercept itself corresponds to whatever values those other predictors take at their model origin, often zero for numeric predictors. It is not automatically the overall portfolio’s average fitted response.
Grand Mean Is Not the Portfolio Average
The unweighted geometric mean treats each factor level equally in the centering definition. A portfolio average instead depends on the portfolio’s distribution across levels and, for a rate, the relevant exposure weights. Consequently, a centered factor can have relativities whose geometric mean is one while the portfolio-weighted average relativity is greater or less than one.
Worked Example: Separating Grand-Mean and Exposure-Weighted Rates
A hypothetical insurer’s fitted rates for three equipment classes are $40, $80, and $160. They arise from a log-link model with unweighted sum-to-zero effects. The classes have exposures of 1, 2, and 7 units. Find the grand-mean rate and the exposure-weighted portfolio rate.
Method. Use the geometric mean for the unweighted grand mean and total fitted cost divided by total exposure for the portfolio rate.
Step 1: Calculate the grand-mean rate. The product of the class rates is \(40\times80\times160=512{,}000\). Since \(80^3=512{,}000\), the unweighted geometric mean is $80.
Step 2: Calculate the exposure-weighted rate. The fitted costs by class are \(1\times\$40=\$40\), \(2\times\$80=\$160\), and \(7\times\$160=\$1{,}120\). Total fitted cost is \(\$40+\$160+\$1{,}120=\$1{,}320\), and total exposure is \(1+2+7=10\). The portfolio rate is \(\$1{,}320/10=\$132\) per exposure unit.
Check and common mistake. The grand mean is $80, while the exposure-weighted rate is $132 because most exposure is in the highest-rate class. Calling $80 the portfolio average confuses the model’s unweighted centering with the portfolio’s exposure mix.
Common Exam Traps
- Calling the intercept an arithmetic average. Sum-to-zero constraints average the linear predictors. Under a log link, exponentiation turns that average into a geometric mean, not an arithmetic mean.
- Reading a centered coefficient as a reference comparison. A sum-to-zero effect compares a level with the grand mean on the model scale. It does not compare that level with the last or omitted category.
- Assuming relativities average to one arithmetically. Their product is one, so their geometric mean is one. Their arithmetic mean need not be one.
- Assuming the grand mean is exposure-weighted. It is unweighted unless the model’s centering constraint explicitly uses weights.
- Confusing displayed contrast columns with all level effects. If only \(K-1\) parameters are printed, recover the remaining level effect from the sum-to-zero constraint before interpreting all levels.
Check Your Understanding
For each problem, identify the centering interpretation before calculating.
- A two-level log-link model has fitted means of $36 and $100 with unweighted sum-to-zero effects. What is the intercept rate, and what are the two relativities? (Answer: Intercept rate $60; relativities \(0.6\) and \(5/3\).)
- A three-level factor has log-link intercept \(\log(50)\) and effects \(\log(0.5)\), \(0\), and \(\log(2)\). Find the three fitted means and verify the constraint. (Answer: $25, $50, and $100; the effects sum to zero.)
- A treatment-coded model has reference rate $200 and two other level rates of $100 and $400. What is the sum-to-zero intercept rate? (Answer: \((100\times200\times400)^{1/3}=200\).)
- Three fitted rates are $30, $60, and $120, with exposures 2, 3, and 5 units, respectively. Find the unweighted grand-mean rate and exposure-weighted rate. (Answer: Grand mean $60; exposure-weighted rate \((2(30)+3(60)+5(120))/10=\$84\).)
- For four levels, the first three log-link effects are \(\log(0.5)\), \(\log(1.5)\), and \(\log(2)\). Find the fourth effect and its relativity. (Answer: Fourth effect \(-\log(1.5)\); relativity \(2/3\).)