Tutorials › CAS Exam 8 - Advanced Ratemaking › Hierarchical Specification of Interaction Terms

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

Hierarchical Specification of Interaction Terms

Apply strong and weak hierarchy to interaction terms, build complete rating specifications, and recognize the limits of hierarchy as a safeguard against unstable estimates.

Intermediate 11 min read

What You'll Learn

  • Distinguish strong hierarchy from weak hierarchy for interaction terms
  • Identify the lower-order terms required by categorical, continuous, and multiway interactions
  • Count the parameters in a hierarchical specification
  • Explain why omitting constituent effects can make a model depend on predictor coding or origin
  • Recognize what hierarchy can and cannot do for interpretability and stability

Why Interaction Specifications Need Structure

An interaction allows the effect associated with one predictor to vary according to another predictor. In a ratemaking GLM, that flexibility can represent genuine differences across segments, but it also adds parameters and complicates the model. A specification rule is therefore useful: when an interaction is included, retain the lower-order effects that make up that interaction.

This rule is called the hierarchical principle. It is a model-building convention, not a theorem that every valid statistical model must obey. Its practical value is that it usually makes the model easier to interpret and less dependent on arbitrary choices such as a continuous predictor's zero point or a categorical factor's reference level. It does not, by itself, guarantee adequate data or stable estimates.

Definition: A model has strong hierarchy if, whenever it includes an interaction, it also includes every constituent lower-order effect. For a two-factor interaction \(x z\), strong hierarchy requires both \(x\) and \(z\). For a three-factor interaction \(x z w\), it requires \(x\), \(z\), \(w\), and all three two-factor interactions \(xz\), \(xw\), and \(zw\). A model has weak hierarchy if each interaction has at least one of its constituent main effects present. Strong hierarchy is the more common default for rating specifications.

For a log-link model, one possible two-predictor specification is

$$ \log(\mu)=\eta=\beta_0+\beta_x x+\beta_z z+\beta_{xz}xz, \qquad \mu=\exp(\eta). $$

Here \(\mu\) is the modeled mean response, such as expected claim cost per exposure unit, and \(\eta\) is the linear predictor. The hierarchy rule concerns which terms appear in \(\eta\); it does not require that any coefficient be nonzero. A fitted main-effect coefficient can be small, but its term is still retained when required by the chosen hierarchy.

What Counts as a Constituent Effect?

For two continuous predictors, the constituents of \(xz\) are the terms for \(x\) and \(z\). For a categorical-by-continuous interaction, the categorical factor's main effect and the continuous predictor's main effect are constituents. When a categorical factor has several levels, its main effect means the factor as a whole, represented by the appropriate set of columns under the chosen coding.

For a multiway interaction, strong hierarchy applies recursively. A three-way term requires every main effect and every two-way interaction among its variables. This is important because including just the three-way term does not automatically include those lower-order terms in a model formula or design matrix.

Specification rule: List the highest-order terms first, then check every subset of their predictors. Under strong hierarchy, include each lower-order term corresponding to a subset. The intercept is ordinarily included in these GLMs, but it is not counted as a predictor main effect.

The exact number of coefficients depends on how predictors are represented. For example, a categorical factor with \(k\) levels typically contributes \(k-1\) columns under reference coding. A categorical-by-continuous interaction then contributes \(k-1\) interaction columns, not just one. Hierarchy applies to the factor-level term and its related model terms, regardless of the number of columns used to represent them.

Worked Example: A Categorical-Continuous Interaction

A hypothetical insurer models expected claim cost using territory and annual mileage. Territory has three levels, represented with two reference-coded columns \(T_1\) and \(T_2\); mileage \(m\) is measured in thousands of miles. The proposed model includes territory-by-mileage interaction. State a strongly hierarchical specification and count its coefficients, including the intercept.

Method. First identify the constituent terms. The interaction is between the territory factor and mileage, so the model must include the territory main effect and the mileage main effect.

Step 1: Count the main-effect columns. The three-level territory factor uses \(3-1=2\) columns. Mileage uses one column. Thus, the main effects contribute \(2+1=3\) coefficients.

Step 2: Count the interaction columns. Each territory contrast interacts with mileage, giving \(2\times1=2\) interaction columns.

Step 3: Add the intercept. The total is \(1+2+1+2=6\) coefficients. A strongly hierarchical linear predictor can be written

$$ \eta=\beta_0+\beta_1T_1+\beta_2T_2+\beta_m m +\beta_{1m}T_1m+\beta_{2m}T_2m. $$

The two territory indicators and the two interaction columns account for all three territory levels relative to the reference coding. The common mistake is to count the territory factor as one coefficient and the whole interaction as one coefficient. The correction is to count design-matrix columns: two for the factor and two for its interaction with mileage. The final check is \(1+2+1+2=6\).

Why Retaining Main Effects Matters

One justification for hierarchy is that a model containing an interaction but omitting its main effects can depend on how the predictors are centered. Consider the linear predictor

$$ \eta=\beta_0+\beta_x x+\beta_z z+\beta_{xz}xz. $$

Define shifted predictors \(x'=x-c\) and \(z'=z-d\), so \(x=x'+c\) and \(z=z'+d\). Substitution gives

$$ \begin{aligned} \eta &=\beta_0+\beta_x(x'+c)+\beta_z(z'+d) +\beta_{xz}(x'+c)(z'+d)\\ &=(\beta_0+\beta_xc+\beta_zd+\beta_{xz}cd) +(\beta_x+\beta_{xz}d)x' +(\beta_z+\beta_{xz}c)z' +\beta_{xz}x'z'. \end{aligned} $$

With the intercept and both main effects present, this is the same model written using a different origin: the coefficients change, but the model can represent the same fitted values. If the main effects are omitted, the shifted expression generally creates \(x'\) and \(z'\) terms that are unavailable in the original specification. The two specifications can then represent different sets of fitted values.

This is why centering a continuous predictor is not merely cosmetic when a model has interactions. A hierarchical specification allows a change of origin to be absorbed by its lower-order terms. This argument explains a structural advantage; it does not establish that every hierarchical model is well estimated or that every nonhierarchical model is invalid.

1
Identify each interaction.
Write down the predictor set that forms each product or interaction term.
2
List its lower-order subsets.
For a two-way interaction, check both main effects. For a three-way interaction, check all main effects and all two-way interactions.
3
Check factor coding and columns.
Translate each categorical term into the required number of design-matrix columns under the chosen coding.
4
Assess data support separately.
Hierarchy determines structural completeness, not whether the observed data can estimate every included term reliably.

Worked Example: Re-Centering Without Changing the Model

A hypothetical log-link model for expected repair cost has two continuous rating predictors \(x\) and \(z\):

$$ \eta=1.2+0.03x-0.02z+0.004xz. $$

The predictors are shifted to \(x'=x-10\) and \(z'=z-5\). Rewrite the model in terms of \(x'\) and \(z'\), then verify the linear predictor at \(x=12\), \(z=8\). Treat the displayed coefficients as fixed hypothetical values; no sampling or estimation assumptions are needed for this algebraic check.

Method. Substitute \(x=x'+10\) and \(z=z'+5\), and expand each term:

$$ \begin{aligned} \eta &=1.2+0.03(x'+10)-0.02(z'+5) +0.004(x'+10)(z'+5)\\ &=1.2+0.03x'+0.30-0.02z'-0.10\\ &\quad+0.004x'z'+0.020x'+0.040z'+0.200\\ &=1.600+0.050x'+0.020z'+0.004x'z'. \end{aligned} $$

The transformed intercept is \(1.2+0.30-0.10+0.20=1.60\). The transformed \(x'\) coefficient is \(0.03+0.004(5)=0.05\); the transformed \(z'\) coefficient is \(-0.02+0.004(10)=0.02\). The interaction coefficient remains \(0.004\).

At \(x=12\), \(z=8\), the original predictor values give

$$ \eta=1.2+0.03(12)-0.02(8)+0.004(12)(8) =1.2+0.36-0.16+0.384=1.784. $$

The shifted values are \(x'=12-10=2\) and \(z'=8-5=3\). Using the transformed model gives

$$ \eta=1.600+0.050(2)+0.020(3)+0.004(2)(3) =1.600+0.100+0.060+0.024=1.784. $$

Both forms produce the same linear predictor, as required. The common mistake is to change the predictor origins but retain the old coefficients. The correction is to expand the substitution and update the intercept and main-effect coefficients as well as the predictor values. The check is that both calculations give \(1.784\).

Multiway Interactions and Model Size

Strong hierarchy has a direct consequence for model size. Suppose three binary predictors \(A\), \(B\), and \(C\) are coded as indicators. Each main effect uses one column. The full three-way interaction uses one column, and each of the three two-way interactions uses one column. A model containing the three-way interaction and all its lower-order terms therefore has one intercept plus seven predictor coefficients.

Worked Example: Completing a Three-Way Specification

A hypothetical insurer considers a three-way interaction among indicators for vehicle use \(A\), garaging type \(B\), and a safety feature \(C\). The predictors are binary, and the model uses a log link. A draft specification contains an intercept and \(ABC\) only. Find the strongly hierarchical specification and its parameter count. Assume all eight combinations of the three binary indicators are possible in the design; this is a count of model columns, not a claim that the data estimate them precisely.

Method. Start from \(ABC\). Its proper lower-order subsets are \(A\), \(B\), \(C\), \(AB\), \(AC\), and \(BC\).

Step 1: Count terms. There are three main-effect columns, \(\binom{3}{2}=3\) two-way columns, and one three-way column. Adding the intercept gives \(1+3+3+1=8\) coefficients.

Step 2: Write the complete predictor.

$$ \begin{aligned} \eta={}&\beta_0+\beta_AA+\beta_BB+\beta_CC\\ &+\beta_{AB}AB+\beta_{AC}AC+\beta_{BC}BC +\beta_{ABC}ABC. \end{aligned} $$

The draft with only an intercept and \(ABC\) has two coefficients, so it is not strongly hierarchical: it omits all three main effects and all three two-way interactions. The correction is to add each required subset term. The count is verified by \(1+3+3+1=8\), including the intercept.

Hierarchy Is Not a Stability Guarantee

A complete hierarchical specification can still be impractical. If some combinations of rating characteristics have little exposure or few claims, interaction coefficients may be estimated imprecisely. Adding every lower-order term also increases the number of parameters, and the resulting model can be unnecessarily complex. Hierarchy does not replace review of exposure, claim counts, validation results, or the intended use of the rating structure.

A further distinction is between a model-building rule and a binding constraint. Strong hierarchy is a widely useful default, particularly when model terms will be communicated as rating effects. A particular application might have a documented reason to constrain or omit a lower-order term. In that case, the analyst should recognize that the resulting specification is nonhierarchical and evaluate the consequences rather than treating the omission as an automatic simplification.

When comparing candidate specifications, the interaction should not be judged in isolation from its constituents. A coherent comparison retains the lower-order terms while assessing whether the additional interaction improves the model sufficiently to justify its complexity. The relevant assessment depends on the modeling objective and validation plan; hierarchy alone does not select the interaction or establish predictive performance.

  • Common exam trap: Including a three-way interaction but checking only for its three main effects. Strong hierarchy also requires all three two-way interactions.
  • Coding trap: Counting a multi-level categorical factor as one coefficient. Count its design columns and the corresponding interaction columns.
  • Interpretation trap: Assuming that a main-effect term must be statistically significant to remain in a hierarchical model. Hierarchy is about specification structure, not a significance test for each constituent.
  • Stability trap: Assuming that a hierarchical specification is automatically stable. Sparse interaction data can still produce uncertain estimates.
Key takeaway: Under strong hierarchy, every interaction is accompanied by all of its lower-order terms. This supports coherent, coding-aware specification, but it does not guarantee that the data can estimate the expanded model reliably. This treatment is aligned with the CAS Exam 8 (Advanced Ratemaking) syllabus.

Check Your Understanding

For each problem, apply the hierarchy rule and check the arithmetic before comparing your answer.

  1. A log-link model includes an interaction between a four-level vehicle class and one continuous age predictor. Under reference coding, how many columns are required for the vehicle main effect, the interaction, and the age main effect together? (Answer: \(3+3+1=7\) columns.)
  2. A model contains \(xy\), with neither \(x\) nor \(y\) included. Is it strongly hierarchical? What terms must be added? (Answer: No; add both \(x\) and \(y\).)
  3. Three binary predictors \(R,S,T\) are used in a model with the \(RST\) interaction. Under strong hierarchy, how many predictor columns, excluding the intercept, are required? (Answer: \(3+3+1=7\): three main effects, three two-way interactions, and one three-way interaction.)
  4. A two-predictor model is \( \eta=0.8+0.1x+0.2z+0.03xz \). Set \(x'=x-4\) and \(z'=z-2\). What is the transformed intercept? (Answer: \(0.8+0.1(4)+0.2(2)+0.03(4)(2)=1.84\).)
  5. A four-predictor model includes a four-way interaction \(ABCD\). Under strong hierarchy, how many non-intercept terms are required if every predictor is binary and represented by one column? (Answer: \(4+6+4+1=15\): four main effects, six two-way interactions, four three-way interactions, and one four-way interaction.)
Clinical Biostats