Why Compare Levels Directly?
A fitted GLM may report coefficients relative to a reference level, or coefficients defined by another contrast scheme. Yet a rating question often asks for a direct comparison: how does the fitted rate for level B compare with the fitted rate for level A? The answer is a linear contrast of the fitted coefficients. Once the contrast is calculated on the log scale, exponentiating it gives the multiplicative relativity.
The key is to compare two otherwise identical risks. Keep their other predictors fixed, and use the same offset when comparing rates. Then the intercept, common predictor contributions, and common offset cancel. The contrast depends on the coding used to represent the factor, but the fitted comparison does not.
The Linear-Contrast Formula
Suppose the modeled rate \(\mu\) has a log link and the linear predictor is \(\eta=\log(\mu)=\mathbf{x}^{T}\boldsymbol{\beta}+o\), where \(\mathbf{x}\) is the design row, \(\boldsymbol{\beta}\) is the coefficient vector, and \(o\) is an offset. Let \(\mathbf{x}_a\) and \(\mathbf{x}_b\) be the design rows for two levels of a factor, with every other predictor held fixed. If their offset is also the same, then
The vector difference \(\mathbf{x}_b-\mathbf{x}_a\) is the contrast. Only columns whose values change between the two profiles contribute. This formulation works with treatment coding, sum-to-zero coding, or other valid contrast coding; the coefficient values and design rows must simply come from the same fitted model.
Why Exponentiating the Contrast Works
The log link relates a rate to its linear predictor by \(\widehat{\mu}=\exp(\widehat{\eta})\). Therefore, for two otherwise matched profiles,
Writing each linear predictor as a coefficient contribution plus the shared terms shows why the contrast formula follows. For example, if \(\widehat{\eta}_a=c+\mathbf{x}_a^T\widehat{\boldsymbol{\beta}}\) and \(\widehat{\eta}_b=c+\mathbf{x}_b^T\widehat{\boldsymbol{\beta}}\), where \(c\) contains the common intercept, other predictors, and offset, subtraction gives
The cancellation requires a like-for-like comparison. If other predictors differ, their contributions must be included; if offsets differ, their difference must also be included. The formula is for the fitted rate under a log link, not for an arbitrary link function.
Worked Example: Comparing Two Treatment-Coded Levels
A hypothetical insurer fits a log-link claim-frequency model with territory as a factor. Territory A is the reference level. The estimated coefficients are \(\widehat{\beta}_B=0.18\) for B and \(\widehat{\beta}_C=-0.12\) for C. Compare the fitted rate for B with the fitted rate for C, holding all other rating variables and the exposure offset fixed.
Method. Under treatment coding, the factor contribution is 0 for A, \(\widehat{\beta}_B\) for B, and \(\widehat{\beta}_C\) for C. Thus the log-rate difference for B relative to C is
The fitted rate ratio is
Therefore, the fitted rate for B is 1.3499 times the fitted rate for C, or about 35.0% higher. Reversing the comparison changes the sign: \(\widehat{\eta}_C-\widehat{\eta}_B=-0.30\), and \(\exp(-0.30)=0.7408\). The reciprocal check holds because \(1/1.3499\) is approximately 0.7408. This method avoids the common mistake of treating \(\widehat{\beta}_B=0.18\) as the B-versus-C contrast; that coefficient compares B with reference A, not with C.
Contrast Coding Changes Coefficients, Not Fitted Comparisons
Under sum-to-zero coding, a factor with three levels may be represented by three level effects constrained to sum to zero. Those effects are not reference-level coefficients. To compare two levels, subtract their fitted effects. For a general contrast coding, first identify each level's design-row values, subtract the rows, and take the resulting weighted sum of the coefficients.
The following examples illustrate why the design rows matter. In each case, the comparison is conditional on the same values of all other predictors and the same offset.
Worked Example: Comparing Levels Under Sum-to-Zero Coding
A hypothetical property model uses sum-to-zero coding for a three-level roof category. The estimated level effects are \(0.12\) for metal, \(-0.04\) for tile, and \(-0.08\) for shingle. Compare tile with shingle.
Method. First verify the constraint: \(0.12+(-0.04)+(-0.08)=0.00\). The fitted log-rate difference for tile relative to shingle is the difference between their effects:
Exponentiating gives
Thus the fitted rate for tile is 1.0408 times the fitted rate for shingle, about 4.08% higher. The intercept and shared terms cancel. The common mistake is to report \(\exp(-0.04)=0.9608\) as the tile-versus-shingle relativity. That exponentiates tile's effect alone; it does not compare tile with shingle. The correct contrast subtracts the shingle effect first.
Worked Example: Using Custom Design Rows
A hypothetical commercial-auto model represents a three-level vehicle class with two custom contrast columns. Its fitted coefficients are \(\widehat{\beta}_1=0.10\) and \(\widehat{\beta}_2=0.04\). The design rows for classes A, B, and C are respectively \((1,0)\), \((0,1)\), and \((-1,-1)\). Compare the fitted rate for A with the fitted rate for C.
Method. Subtract C's design row from A's:
The log-rate difference for A relative to C is the dot product of this contrast with the coefficient estimates:
Therefore,
The fitted rate for A is 1.2712 times the fitted rate for C, about 27.1% higher. As a check, the factor contribution for A is \(1(0.10)+0(0.04)=0.10\), while for C it is \((-1)(0.10)+(-1)(0.04)=-0.14\); their difference is \(0.10-(-0.14)=0.24\). The common mistake is to subtract one coefficient or to assume that a custom-coded coefficient is itself a level relativity. Both design columns change between A and C, so both contribute.
Practical Checks and Exam Traps
A reliable comparison follows the same sequence whether the model output uses reference levels or less familiar contrasts:
Write the requested comparison as level \(b\) relative to level \(a\). Reversing the order reverses the log difference and takes the reciprocal of the relativity.
Hold other predictors and the offset fixed unless the question explicitly requires different profiles. Include any terms that do not cancel.
Subtract \(\mathbf{x}_a\) from \(\mathbf{x}_b\), then multiply by the fitted coefficient vector. Do not assume a coefficient is the requested comparison.
Exponentiate the log-rate difference. State which level is in the numerator and describe the result as a factor or percentage change.
A few checks catch many errors. If the contrast is zero, the fitted rate ratio is 1. If the comparison direction is reversed, the new log difference is the negative of the old one and the new ratio is its reciprocal. Also, a log difference of \(d\) corresponds to a percentage change of \(100(\exp(d)-1)\%\), not \(100d\%\) exactly, although \(100d\%\) can be a small-change approximation.
These comparisons are useful for interpreting fitted rating factors while keeping the coding scheme separate from the underlying fitted rates. The coefficients depend on how the model represents levels; a level-to-level comparison, calculated from the fitted design rows, expresses the modeled relationship directly. This treatment is aligned with the CAS Exam 8 (Advanced Ratemaking) syllabus.
Check Your Understanding
For each problem, calculate the requested log-rate difference first, then the multiplicative relativity.
- A treatment-coded factor has reference level L and estimates \(\widehat{\beta}_M=0.25\) and \(\widehat{\beta}_N=-0.10\). What is the fitted rate for N relative to M, with other predictors fixed? (Answer: log-rate difference \(-0.35\); relativity \(0.7047\).)
- Under sum-to-zero coding, three level effects are \(0.09\), \(-0.03\), and \(-0.06\) for P, Q, and R. Compare P with R. (Answer: log-rate difference \(0.15\); relativity \(1.1618\).)
- A custom-coded factor has \(\widehat{\beta}_1=0.08\), \(\widehat{\beta}_2=-0.02\), and design rows A \((1,0)\), B \((0,1)\), C \((-1,-1)\). Compare B with C. (Answer: log-rate difference \(0.04\); relativity \(1.0408\).)
- A treatment-coded factor has reference level U and estimates \(\widehat{\beta}_V=-0.20\) and \(\widehat{\beta}_W=0.05\). Compare U with W, then verify by reversing the comparison. (Answer: U relative to W has log-rate difference \(-0.05\) and relativity \(0.9512\); W relative to U has relativity \(1.0513\).)
- A fitted model has a three-level factor with design rows J \((1,0)\), K \((0,1)\), and L \((-1,-1)\), and coefficients \(0.06\) and \(0.03\). Compare K with L. (Answer: log-rate difference \(0.12\); relativity \(1.1275\).)