What a Treatment-Coded Coefficient Represents
A treatment-coded factor compares each non-reference category with one designated reference category. The coefficients are therefore not a list of category means: each coefficient is a difference from the reference, measured on the model’s linear predictor scale. To calculate a fitted value for a category, combine its coefficient with the intercept and any other predictor contributions.
The response scale matters. In a model with an identity link, a coefficient is a difference in the fitted response. In a model with a log link, exponentiating a coefficient gives a multiplicative comparison of fitted means. In a model with a logit link, exponentiating a coefficient gives an odds ratio. These interpretations require different calculations, even though all three models can use treatment coding.
Write the model’s linear predictor as \(\eta\), and let \(g\) be its link function. Under a generalized linear model, the conditional mean is \(E[Y\mid \text{predictors}]=g^{-1}(\eta)\). The factor coefficients describe differences in \(\eta\), not necessarily differences in \(E[Y\mid \text{predictors}]\). If the model includes numeric predictors, calculate their contributions at the specified values before interpreting category fitted values.
Fitted Values and Pairwise Contrasts
For a factor with reference category 0 and non-reference categories 1 through \(K-1\), let \(\eta_{\text{base}}\) contain the intercept and all other predictor contributions. The fitted linear predictor for the reference is \(\eta_{\text{base}}\); for category \(j\), it is \(\eta_{\text{base}}+\beta_j\). Thus a comparison between two non-reference categories subtracts their coefficients. The shared intercept and other predictor contributions cancel.
This subtraction is the key to a pairwise comparison. For an identity link, \(\eta\) is the fitted mean itself, so the subtraction gives a mean difference. For a log link, it gives a log mean ratio; exponentiating gives the mean ratio. For a logit link, it gives a log odds ratio; exponentiating gives the odds ratio. With nonlinear links, a difference in fitted responses is found by calculating both fitted responses and subtracting them, not by treating the coefficient difference as a response-scale difference.
Worked Examples
Worked Example: Expected Claim Cost Under an Identity Link
A hypothetical insurer models expected annual claim cost per policy using an identity-link model. The factor is vehicle use, with Personal as the reference category. At a fixed value \(x=2\) of a numeric rating variable, the estimated model is
Calculate the fitted annual claim cost for each use category, and compare Delivery with Farm. Assume the model’s fitted conditional mean is the fitted linear predictor, as specified by the identity link.
Method and calculation. First calculate the shared contribution from the intercept and numeric predictor: \(400+50(2)=400+100=500\). Personal is the reference, so all its factor indicators are 0 and its fitted cost is \(\$500\).
For Commercial, only \(I_{\text{Commercial}}=1\), giving \(500+150=\$650\). For Farm, only \(I_{\text{Farm}}=1\), giving \(500-30=\$470\). For Delivery, only \(I_{\text{Delivery}}=1\), giving \(500+240=\$740\).
The Delivery-versus-Farm difference is \(740-470=\$270\). Equivalently, subtract their coefficients: \(240-(-30)=270\). The model therefore predicts an annual cost \(\$270\) higher for Delivery than Farm at the same \(x=2\).
Check. The coefficient difference and the fitted-value difference agree. The common contribution of \(\$500\) cancels. This calculation avoids the mistake of comparing either category coefficient with the intercept or treating the Farm coefficient of \(-30\) as Farm’s fitted cost.
Worked Example: Claim Frequency Under a Log Link
A hypothetical portfolio model uses a Poisson response and a log link for the expected claim count per policy-year. The categorical predictor is equipment class, with Standard as the reference. At the fixed predictor values in this example, the estimated linear predictor is \(\log(0.04)\) for Standard, with treatment-coded coefficients \(\log(1.5)\) for Enhanced, \(\log(2)\) for Heavy Duty, and \(\log(0.75)\) for Compact. Calculate the fitted frequencies and compare Compact with Enhanced.
Model and method. For this calculation, the conditional claim count has a Poisson distribution with mean \(\lambda\), and the model specifies \(\log(\lambda)=\eta\). Hence \(\lambda=\exp(\eta)\). The reference mean is \(\exp(\log(0.04))=0.04\) claims per policy-year.
For Enhanced, add its coefficient on the log scale: \(\eta=\log(0.04)+\log(1.5)=\log(0.04\times1.5)=\log(0.06)\). The fitted mean is therefore \(0.06\). For Heavy Duty, \(\eta=\log(0.04)+\log(2)=\log(0.08)\), giving \(0.08\). For Compact, \(\eta=\log(0.04)+\log(0.75)=\log(0.03)\), giving \(0.03\).
The Compact-versus-Enhanced coefficient difference is \(\log(0.75)-\log(1.5)=\log(0.5)\). Exponentiating gives a fitted mean ratio of \(\exp(\log(0.5))=0.5\): Compact’s fitted frequency is half Enhanced’s. The response-scale difference is \(0.03-0.06=-0.03\) claims per policy-year.
Check. The fitted means have ratio \(0.03/0.06=0.5\), as implied by the coefficient contrast. A common error is to read \(\log(1.5)\), approximately \(0.4055\), as an increase of 0.4055 claims per policy-year. It is instead a log mean ratio; the multiplicative comparison is 1.5, or a 50% higher mean than the reference.
Worked Example: Claim Probability Under a Logit Link
A hypothetical model estimates the probability that a submitted claim requires additional review. Its factor is documentation tier, with Basic as the reference. At the stated values of all other predictors, the fitted probability for Basic is 0.10. The treatment-coded coefficients are \(\log(2)\) for Enhanced and \(\log(0.5)\) for Streamlined. Calculate the fitted probabilities and compare Streamlined with Enhanced.
Model and method. The model is logistic: \(\operatorname{logit}(p)=\log\{p/(1-p)\}=\eta\). For Basic, the odds are \(0.10/(1-0.10)=0.10/0.90=1/9\). The corresponding fitted probability is given by \(p=\text{odds}/(1+\text{odds})\).
For Enhanced, the odds are the reference odds multiplied by \(\exp(\log(2))=2\): \(2/9\). Its fitted probability is \((2/9)/(1+2/9)=(2/9)/(11/9)=2/11=0.1818\), to four decimals.
For Streamlined, the odds are \((1/9)\times\exp(\log(0.5))=1/18\). Its fitted probability is \((1/18)/(1+1/18)=(1/18)/(19/18)=1/19=0.0526\), to four decimals. The Streamlined-versus-Enhanced coefficient contrast is \(\log(0.5)-\log(2)=\log(0.25)\), so the odds ratio is 0.25. The probability difference is \(1/19-2/11=(11-38)/209=-27/209=-0.1292\), to four decimals.
Check and trap. The odds ratio \(0.25\) agrees with \((1/18)/(2/9)=1/4\). The probability difference, approximately \(-0.1292\), is a separate calculation. Treating the coefficient \(\log(2)\), approximately \(0.6931\), as a 0.6931 increase in probability would incorrectly predict \(0.7931\) for Enhanced. The coefficient doubles the odds; it does not add directly to the probability.
Why the Pairwise Formula Holds
The pairwise contrast follows directly from the indicator representation. Suppose the reference has all factor indicators equal to 0, and category \(j\) has only indicator \(I_j=1\). At fixed values of the other predictors, write their combined contribution as \(c\). The two linear predictors are \(c+\beta_j\) and \(c+\beta_k\). Subtracting the second from the first removes the shared contribution:
This establishes the contrast on the linear predictor scale. The inverse link then determines how to express it on the response scale. With the identity link, \(g^{-1}(\eta)=\eta\), so the response difference is \(\beta_j-\beta_k\). With a log link, if the fitted means are \(\mu_j\) and \(\mu_k\), then
With a logit link, the same subtraction applies to the logits, which are log odds. Exponentiating the contrast therefore gives the odds ratio. In neither nonlinear-link case does exponentiating a coefficient give a probability or claim-count difference.
Interpreting Model Output Carefully
When reading a treatment-coded model output, first identify the reference category and the link function. Then determine whether the requested result is a fitted value, a coefficient interpretation, a pairwise contrast, or a response-scale difference. These are related but not interchangeable quantities.
- Fitted value: include the intercept, the relevant factor coefficient, and all other predictor contributions; then apply the inverse link if needed.
- Reference comparison: the non-reference coefficient is the linear-predictor contrast against the reference, holding other predictors fixed.
- Two non-reference categories: subtract their coefficients to obtain the contrast on the linear predictor scale.
- Nonlinear link: exponentiate a log-scale contrast to obtain a ratio, but calculate both inverse-linked fitted values to obtain a response-scale difference.
A coefficient describes the model’s adjusted comparison, not necessarily a causal effect. It is conditional on the predictors included and the model specification. Also, if category indicators interact with another predictor, category comparisons can depend on that predictor’s value; the no-interaction formulas above must then be expanded to include the interaction contributions.
Check Your Understanding
For each problem, identify the relevant scale before calculating. Final answers are provided for checking.
- A hypothetical identity-link model predicts annual benefit cost. The reference category has fitted cost \(\$300\), while categories North and South have treatment coefficients \(65\) and \(-25\). Find all three fitted costs and the North-versus-South difference. (Answer: Reference \(\$300\), North \(\$365\), South \(\$275\); North is \(\$90\) higher than South.)
- A hypothetical Poisson log-link model has reference mean \(0.05\) claims per exposure unit. Treatment coefficients for Class X and Class Y are \(\log(1.2)\) and \(\log(0.8)\). Find both fitted means and the Y-versus-X mean ratio. (Answer: X \(0.06\), Y \(0.04\); Y-to-X ratio \(2/3\).)
- A hypothetical logistic model has reference probability \(0.20\). The coefficients for Tier B and Tier C are \(\log(3)\) and \(\log(0.5)\). Find both fitted probabilities and the B-versus-C odds ratio. (Answer: B \(3/7=0.4286\), C \(1/9=0.1111\); B-to-C odds ratio \(6\).)
- An identity-link model has linear predictor \(100+20x+30I_B-10I_C\), with category A as reference. At \(x=3\), find the fitted value for each category and the B-versus-C contrast. (Answer: A \(160\), B \(190\), C \(150\); B is \(40\) higher than C.)
- A hypothetical log-link model has fitted mean \(0.02\) for reference class A. The coefficients for B and C are \(\log(1.5)\) and \(\log(0.6)\). Find the fitted means, the C-versus-B mean ratio, and the response-scale difference C minus B. (Answer: B \(0.03\), C \(0.012\); C-to-B ratio \(0.4\); difference \(-0.018\) per stated exposure unit.)