Tutorials › CAS Exam 8 - Advanced Ratemaking › Alternative Contrasts and Their Interpretation

CAS Exam 8 · Predictor Design and Interactions · Tutorial 198 of 989

Alternative Contrasts and Their Interpretation

Learn to translate reference-coded coefficients into sum-to-zero effects, interpret the shifted intercept, and verify that the model’s fitted rates do not change.

Intermediate 11 min read

What You'll Learn

  • Derive the conversion from reference-coded coefficients to sum-to-zero effects
  • Interpret effect-coded coefficients as deviations from the mean log rate across factor levels
  • Convert the intercept and relate it to a geometric mean of fitted rates
  • Verify that fitted rates and level-to-level relativities are invariant to the coding
  • Recognize when equal-level effect coding does not represent a weighted portfolio average

Why Change the Contrast Coding?

A categorical rating factor can be represented in more than one way in a generalized linear model. Reference coding makes each coefficient a comparison with a selected reference level. Effect coding instead represents each level as a deviation from a common center, with the level effects constrained to sum to zero. The numerical coefficients and intercept change, but a mere change of coding does not change the fitted rates.

The distinction matters when reading model output or communicating a rating indication. An effect-coded coefficient is not a comparison with the reference level; it is a deviation from the factor’s unweighted mean on the linear-predictor scale. In a log-link model, that center corresponds to a geometric mean, not an arithmetic mean.

Definition: Suppose a categorical rating factor has \(K\) levels, and the model uses a log link with an intercept and no interaction involving that factor. Under reference coding, let the reference level’s coefficient be \(b_1=0\), and let \(b_j\) be the coefficient for level \(j\), for \(j=2,\ldots,K\). Define \(m=\frac{1}{K}\sum_{j=1}^K b_j\). The effect-coded coefficients are \(\gamma_j=b_j-m\), so \(\sum_{j=1}^K\gamma_j=0\), and the effect-coded intercept is \(\alpha_E=\alpha_R+m\), where \(\alpha_R\) is the reference-coded intercept.

In an implementation with an intercept, effect coding uses \(K-1\) columns; the final level’s effect is implied by the requirement that all \(K\) effects sum to zero. Including an intercept and \(K\) unrestricted level indicators would be redundant. The definition above gives all \(K\) level effects to make their interpretation and conversion explicit.

These formulas apply to the same unpenalized model with the same observations, predictors, and link, when the contrast coding spans the same model space. Other predictors and any offset remain unchanged. For a log-link rate model, the linear predictor is the logarithm of the fitted rate, so preserving it preserves the rate.

Deriving the Conversion

The conversion follows by requiring the new coding to give the same linear predictor for every level. Hold other predictors fixed and write the reference-coded predictor for level \(j\) as \(\eta_j=\alpha_R+b_j\). Under effect coding it is \(\eta_j=\alpha_E+\gamma_j\). The mean \(m\) centers the original coefficients: subtracting it makes their sum zero, while adding it to the intercept offsets that subtraction.

$$ \gamma_j=b_j-m,\qquad \alpha_E=\alpha_R+m $$

Substitution verifies both the fitted values and the zero-sum constraint:

$$ \alpha_E+\gamma_j=(\alpha_R+m)+(b_j-m)=\alpha_R+b_j=\eta_j, \qquad \sum_{j=1}^{K}\gamma_j=\sum_{j=1}^{K}b_j-Km=0. $$

For a log link, \(\mu_j=\exp(\eta_j)\), where \(\mu_j\) is the fitted rate for level \(j\) with other predictors held fixed. Since \(\eta_j\) is unchanged, \(\mu_j\) is unchanged as well. Further, for any two levels \(j\) and \(l\), \(\gamma_j-\gamma_l=b_j-b_l\). Thus the level-to-level log contrast, and its multiplicative rate ratio after exponentiation, is invariant.

Interpretation: With one categorical factor and other predictors held fixed, \(\alpha_E\) is the mean of the \(K\) level-specific log fitted rates. Exponentiating it gives their geometric mean. Each \(\gamma_j\) is the difference between level \(j\)’s log fitted rate and that mean. It is not generally a deviation from an arithmetic or exposure-weighted average rate.

With several categorical factors in an additive log-link model, the conversion is applied separately to each factor. The intercept increases by the sum of the factors’ coefficient means, and each factor’s effects are centered within that factor. The fitted predictor for every combination of factor levels remains the same. This statement is for additive main effects; interactions require their own contrast interpretation.

Worked Conversions

Worked Example: Three Levels and a Geometric-Mean Intercept

Hypothetical scenario. A log-link model estimates a pure-premium rate for a three-level vehicle-use factor. The reference level A has fitted rate $75, and the reference-coded coefficients for B and C are \(\ln 2\) and \(\ln 8\). Convert to effect coding and check all three fitted rates. There is no discounting, mortality assumption, or separate loss distribution in this fitted-rate calculation.

Method. The reference-coded coefficients, including the zero for A, are \(b_A=0\), \(b_B=\ln2\), and \(b_C=\ln8\). Their mean is

$$ m=\frac{0+\ln2+\ln8}{3} =\frac{\ln16}{3} =0.924196\ldots $$

The reference-coded intercept is \(\alpha_R=\ln75\). Therefore the effect-coded intercept is

$$ \alpha_E=\ln75+\frac{\ln16}{3}, \qquad \exp(\alpha_E)=75\cdot16^{1/3} =188.988\ldots $$

The effect for each level is its reference-coded coefficient minus \(m\):

$$ \gamma_A=-\frac{\ln16}{3}=-0.924196\ldots,\qquad \gamma_B=\ln2-\frac{\ln16}{3}=-0.231049\ldots, \qquad \gamma_C=\ln8-\frac{\ln16}{3}=1.155245\ldots $$

The effects sum to zero: \(-\ln16/3+(\ln2-\ln16/3)+(\ln8-\ln16/3)=0\), since \(\ln2+\ln8=\ln16\). To check the fitted rates, add each effect to the new intercept. For A, \(\exp(\alpha_E+\gamma_A)=\exp(\ln75)=\$75\). For B, \(\exp(\alpha_E+\gamma_B)=\exp(\ln75+\ln2)=\$150\). For C, \(\exp(\alpha_E+\gamma_C)=\exp(\ln75+\ln8)=\$600\). These are exactly the original rates. The intercept rate is also their geometric mean: \((75\cdot150\cdot600)^{1/3}=\$188.988\ldots\). Round only now: the intercept rate is $188.99, and the effects to four decimals are \(-0.9242\), \(-0.2310\), and \(1.1552\).

Common mistake avoided: The intercept shifts by the mean of all three coefficients, including the reference-level zero. Omitting the zero or misadding the logarithms gives an incorrect center and breaks the fitted-rate check.

Worked Example: Four Levels With Non-Unit Relativities

Hypothetical scenario. A log-link model has reference level A with rate $80. The reference-coded multiplicative relativities for B, C, and D are \(0.75\), \(1.5\), and \(3\), respectively. Find the effect-coded intercept rate and effects, then verify the level rates. No interest, mortality, or additional random-loss assumption is needed: the inputs are fitted rates from the model.

Method. The reference-coded coefficients are \(0\), \(\ln0.75\), \(\ln1.5\), and \(\ln3\). Their mean is

$$ m=\frac{\ln(0.75)+\ln(1.5)+\ln3}{4} =\frac{\ln(0.75\cdot1.5\cdot3)}{4} =\frac{\ln3.375}{4} =0.304099\ldots $$

The effect-coded intercept rate is the reference rate multiplied by \(\exp(m)\):

$$ \exp(\alpha_E)=80\exp(m)=80(3.375)^{1/4} =108.432\ldots $$

The four effects, calculated as \(b_j-m\), are

$$ \begin{aligned} \gamma_A&=-m=-0.304099\ldots,\\ \gamma_B&=\ln0.75-m=-0.591781\ldots,\\ \gamma_C&=\ln1.5-m=0.101366\ldots,\\ \gamma_D&=\ln3-m=0.794513\ldots. \end{aligned} $$

Their sum is zero because the sum of the four original coefficients is \(4m\). Check the rates using the original reference rate and relativities: A is \(80\), B is \(80(0.75)=60\), C is \(80(1.5)=120\), and D is \(80(3)=240\). The effect-coded intercept is their geometric mean, \( (80\cdot60\cdot120\cdot240)^{1/4}=108.432\ldots\), and adding each level’s effect on the log scale returns those same four rates. Rounded at the final step, the intercept rate is $108.43; the effects to four decimals are \(-0.3041\), \(-0.5918\), \(0.1014\), and \(0.7945\).

Common mistake avoided: The mean is taken on the log-coefficient scale. Averaging the four dollar rates would produce an arithmetic mean, which is not the effect-coded intercept rate.

Worked Example: Two Factors and an Unchanged Policy Indication

Hypothetical scenario. An additive log-link model has a base rate of $50 at vehicle-use level U1 and territory T1. Relative to U1, the use-factor relativities for U2 and U3 are \(2\) and \(4\). Relative to T1, the territory relativity for T2 is \(3\). Convert both factors to effect coding and verify the indication for a policy in U2 and T2. There are no interactions, and no discounting, mortality, or separate loss distribution enters this rate calculation.

Method. For vehicle use, the reference-coded coefficients are \(0,\ln2,\ln4\). Their mean is \(m_U=(\ln8)/3\). For territory, they are \(0,\ln3\), with mean \(m_T=(\ln3)/2\). The new intercept rate is therefore

$$ 50\exp(m_U+m_T) =50\cdot8^{1/3}\cdot3^{1/2} =100\sqrt{3} =173.205\ldots $$

The use effects are \(\gamma_{U1}=-\ln8/3\), \(\gamma_{U2}=\ln2-\ln8/3=0\), and \(\gamma_{U3}=\ln4-\ln8/3=\ln2\). The territory effects are \(\gamma_{T1}=-\ln3/2\) and \(\gamma_{T2}=\ln3-\ln3/2=\ln3/2\). Each factor’s effects sum to zero.

For U2 and T2, the effect-coded log rate is \(\alpha_E+\gamma_{U2}+\gamma_{T2}\). Its exponential is

$$ 100\sqrt{3}\cdot1\cdot\sqrt{3}=300. $$

The reference-coded calculation gives the same answer: \(50\cdot2\cdot3=\$300\). As a further check, U3/T2 gives \(50\cdot4\cdot3=\$600\) under reference coding; effect coding gives \(100\sqrt3\cdot2\cdot\sqrt3=\$600\). The two requested profiles therefore have unchanged fitted rates. Rounding only at the final step, the shifted intercept rate is $173.21, and the U2/T2 indication is $300.00.

Common mistake avoided: Center each factor’s coefficients separately and add both shifts to the intercept. Centering the combined set of coefficients as though the factors were one factor would give the wrong parameterization.

What Changes and What Does Not

QuantityReference codingEffect codingWhat to remember
InterceptLinear predictor at all reference levelsShifted by the mean coefficients for the recoded factorsIt is not generally the rate at a particular observed combination of levels
Factor coefficientLevel’s log contrast with its referenceLevel’s deviation from the unweighted mean log effectExponentiated effects are multiplicative deviations from the geometric center
Fitted rateObtained from the linear predictorObtained from the same linear predictorUnchanged by this reparameterization
Level-to-level contrastDifference between the two level coefficientsDifference between the two level effectsUnchanged, as are the implied rate ratios

The model’s fitted rates and rating indications are invariant because the conversion preserves the linear predictor. The coefficient values, however, are different; standard errors and covariances must be read from the output for the chosen parameterization. An individual effect-coded coefficient tests a level’s deviation from the coding’s center, whereas a reference-coded coefficient tests its contrast with the selected reference. These are different questions, even though the underlying fitted model is the same.

Common Exam Trap

A frequent error is to average coefficients incorrectly, then carry that incorrect center into both the effects and the intercept. For the three-level example above, an incorrect calculation is

$$ \frac{\ln2+\ln8}{3}=\frac{\ln4}{3}. $$

This is wrong because \(\ln2+\ln8=\ln16\), not \(\ln4\). The correct mean, including the reference coefficient zero, is

$$ \frac{0+\ln2+\ln8}{3}=\frac{\ln16}{3}. $$

Using the incorrect mean would make the effects fail to sum to zero and would shift the intercept by the wrong amount. A reliable check is to verify both \(\sum_j\gamma_j=0\) and \(\alpha_E+\gamma_j=\alpha_R+b_j\) for every level. For multiple factors, perform those checks separately by factor and verify at least one combined profile.

Key takeaway: Effect coding is a reparameterization, not a different rating model. Subtract the unweighted mean of the reference-coded coefficients from each level coefficient, add that mean to the intercept, and verify that the linear predictor is unchanged. For a log link, the centered intercept exponentiates to a geometric mean, not an arithmetic portfolio average.

Check Your Understanding

Work each conversion on the log scale, then check the zero-sum constraint or a fitted rate.

  1. A three-level factor has reference-coded coefficients \(0,\ln3,\ln6\). Write the three effect-coded coefficients. (Answer: \(-\ln18/3,\ \ln3-\ln18/3,\ \ln6-\ln18/3\); they sum to zero.)
  2. A three-level factor has reference rate $90 and reference-coded coefficients \(0,\ln2,\ln5\). Find the effect-coded intercept rate. (Answer: \(90\cdot10^{1/3}=\$193.90\), rounded to cents.)
  3. A four-level factor has reference rate $64 and relativities \(1,\ 0.5,\ 2,\ 8\). Find the effect-coded intercept rate and the log contrast between the last two levels. (Answer: Intercept rate \(64\cdot8^{1/4}=\$107.63\), rounded to cents; last-versus-third log contrast \(\ln8-\ln2=\ln4\), so the rate ratio is \(4\).)
  4. An additive model has two two-level factors. Their reference-coded coefficients are \(0,\ln2\) and \(0,\ln4\), with reference-level rate $30. Find the effect-coded intercept rate and the fitted rate when both factors are at their nonreference levels. (Answer: Intercept rate \(30\exp(\ln2/2+\ln4/2)=60\sqrt2=\$84.85\), rounded to cents; fitted rate \(30\cdot2\cdot4=\$240.00\).)
  5. In a factor with levels having very different exposure volumes, does ordinary sum-to-zero effect coding make the intercept the exposure-weighted average fitted rate? (Answer: No. It centers the level coefficients equally on the log scale; the exponentiated intercept is the unweighted geometric mean across levels, conditional on other predictors.)
Clinical Biostats