Tutorials › Exam SRM - Statistics for Risk Modeling › Reference Categories and Logistic Contrasts

Exam SRM · GLM Modeling Cases · Tutorial 865 of 926

Reference Categories and Logistic Contrasts

Translate indicator-coded logistic coefficients into clear comparisons, including odds ratios between two nonreference categories and what changes when the reference category changes.

Advanced 10 min read

What You'll Learn

  • Identify the reference level and indicator variables in a logistic-regression model.
  • Interpret nonreference coefficients as comparisons with the reference category.
  • Calculate odds ratios comparing two nonreference categories.
  • Re-express coefficients when the reference category changes.
  • Avoid confusing a coefficient, an odds ratio, and a probability difference.

Why Reference Categories Matter

A categorical predictor such as coverage tier or service region may have several levels. A logistic-regression model needs a numerical representation of those levels, and indicator coding provides one. The chosen reference category is the comparison point: each estimated coefficient describes a comparison with that category, not an isolated effect belonging to a level. To compare two nonreference categories, the relevant quantity is the difference between their coefficients.

This distinction is important when interpreting a fitted model or communicating a comparison that the output does not display directly. The odds ratio for a nonreference category against the reference is obtained by exponentiating its coefficient. For two nonreference categories, subtract the coefficients first, then exponentiate.

Definition: Suppose a categorical predictor \(C\) has \(K\) levels, labelled \(1,\ldots,K\), and level 1 is the reference category. Treatment (reference) indicator coding uses \(K-1\) variables, \(I(C=j)\), for \(j=2,\ldots,K\). The indicator equals 1 when an observation is in level \(j\), and 0 otherwise. Level 1 has all these indicators equal to 0.

The Logistic Model With Indicator Coding

Let \(Y\) be a binary response. Under a logistic-regression model, conditional on predictors, \(Y\) has a Bernoulli distribution with probability \(\pi=P(Y=1\mid\text{predictors})\). The logit link states that the log odds are a linear predictor. For one categorical predictor and other predictors \(x_1,\ldots,x_p\), a model with no interactions can be written as follows:

$$ \log\left(\frac{\pi}{1-\pi}\right) =\beta_0+\sum_{r=1}^{p}\gamma_r x_r +\sum_{j=2}^{K}\beta_j I(C=j). $$

Here \(\beta_0\) is the intercept for the reference level when the other predictors are zero. Each \(\beta_j\) is the difference in log odds between level \(j\) and the reference level, at the same values of the other predictors. The model describes conditional associations; a coefficient alone does not establish a causal effect.

This specification assumes the log odds are linear in the included predictors and that the observations are conditionally independent given those predictors. The stated interpretation also presumes the categorical effect is not modified by an interaction with another predictor. If a model includes such an interaction, the category comparison can depend on the value of the interacting predictor; the simple coefficient difference must then include the relevant interaction terms.

Key result: Write \(\beta_1=0\) for the reference category. At fixed values of all other predictors, the odds ratio comparing category \(a\) with category \(b\) is $$ \operatorname{OR}_{a:b}=\exp(\beta_a-\beta_b). $$ If \(b\) is the reference category, this reduces to \(\exp(\beta_a)\). Reversing the comparison gives the reciprocal odds ratio.

Why the Contrast Formula Works

The formula follows by writing the two category-specific log odds and subtracting. All terms that are held fixed cancel, leaving only the difference between the category coefficients.

1
Write the log odds for category \(a\).
At fixed other predictors, the predictor-dependent terms are common to all categories. The category-specific contribution is \(\beta_a\).
2
Subtract the log odds for category \(b\).
The intercept and all fixed predictor terms cancel, so the difference in log odds is \(\beta_a-\beta_b\).
3
Convert the log-odds difference to an odds ratio.
Exponentiation reverses the logarithm: the odds in category \(a\) divided by the odds in category \(b\) is \(\exp(\beta_a-\beta_b)\).
$$ \log\left(\frac{\text{odds}_a}{\text{odds}_b}\right) =\log(\text{odds}_a)-\log(\text{odds}_b) =\beta_a-\beta_b \quad\Longrightarrow\quad \frac{\text{odds}_a}{\text{odds}_b}=\exp(\beta_a-\beta_b). $$

This argument also explains why the reference category is a coding choice, not a special population whose odds are inherently fixed. Changing the reference changes the intercept and coefficient labels, but it does not change fitted probabilities or the odds ratio for any specified pair of categories.

Worked Example: Comparing Two Service Channels

A hypothetical insurer models whether a submitted service request is resolved within one day. The predictor channel has levels direct, broker, and online, with direct as the reference. At fixed customer age and request type, the fitted coefficients are \(\beta_{\text{broker}}=\log(1.4)\) and \(\beta_{\text{online}}=\log(0.8)\). The direct-channel probability for a particular profile is 0.20. Find the odds ratio for online versus broker and the three fitted probabilities for that profile.

Method. Use the coefficient difference for the comparison between two nonreference levels. Use the reference probability to find the reference odds, then multiply by each category's odds ratio against direct.

The direct-channel odds are \(0.20/(1-0.20)=0.20/0.80=0.25\). Broker odds are \(1.4(0.25)=0.35\), and online odds are \(0.8(0.25)=0.20\).

The odds ratio for online versus broker is \(\exp(\log(0.8)-\log(1.4))=0.8/1.4=4/7=0.5714\). Thus the online odds are about 0.5714 times the broker odds; the reverse comparison is \(7/4=1.75\).

Convert each set of odds to a probability using \(p=\text{odds}/(1+\text{odds})\). Direct gives \(0.25/1.25=0.20\). Broker gives \(0.35/1.35=0.259259\ldots\). Online gives \(0.20/1.20=0.166667\ldots\). Rounded to four decimal places, the probabilities are 0.2000, 0.2593, and 0.1667, respectively.

Check. The online-to-broker odds ratio from the odds is \(0.20/0.35=4/7\), matching the coefficient contrast. The probabilities do not have that same ratio; the result concerns odds, not probabilities. The common mistake avoided here is interpreting an odds ratio as a probability ratio.

Reading and Building Contrasts

For a categorical predictor with several levels, the model output usually gives each nonreference coefficient separately. A requested comparison may not appear as a single row. Translate the requested order into a contrast: for “\(a\) versus \(b\),” calculate \(\beta_a-\beta_b\). Exponentiate only after taking that difference. State the direction of comparison, because reversing it changes the odds ratio to its reciprocal.

The following table summarizes the common cases. The reference coefficient is defined as zero for this contrast notation; it is not an additional fitted parameter.

Requested comparisonLog-odds contrastOdds ratio
Level \(j\) versus reference\(\beta_j-0\)\(\exp(\beta_j)\)
Level \(a\) versus nonreference level \(b\)\(\beta_a-\beta_b\)\(\exp(\beta_a-\beta_b)\)
Reference versus level \(j\)\(0-\beta_j\)\(\exp(-\beta_j)=1/\exp(\beta_j)\)

Worked Example: Comparing Two Regions Through a Third Reference Level

A hypothetical risk study uses urban as the reference region. At fixed values of the other predictors, the fitted coefficients are \(\beta_{\text{suburban}}=\log(1.25)\), \(\beta_{\text{rural}}=\log(2)\), and \(\beta_{\text{remote}}=\log(3)\). Find the odds ratio for remote versus suburban, and interpret it.

Method. Both requested categories are nonreference levels, so subtract their coefficients in the order remote minus suburban: \(\log(3)-\log(1.25)=\log(3/1.25)=\log(2.4)\).

Exponentiating gives \(\exp(\log(2.4))=2.4\). At the same values of the other modeled predictors, the odds for the outcome in the remote region are 2.4 times the odds in the suburban region.

As a check using the reference comparisons, remote-to-urban odds are 3 and suburban-to-urban odds are 1.25. Their ratio is \(3/1.25=2.4\), the same contrast. The common mistake avoided is reporting 3 as the remote-versus-suburban odds ratio; 3 compares remote with urban, not with suburban.

Changing the Reference Category

A new reference category changes how the same model is expressed. If category \(r\) becomes the reference, the new intercept absorbs the old coefficient for \(r\), and every other category coefficient becomes its old coefficient minus the old coefficient for \(r\). The continuous-predictor coefficients remain unchanged in this no-interaction model. This is a reparameterization: it changes the coordinates used to describe the model, not the fitted category comparisons.

$$ \beta'_0=\beta_0+\beta_r,\qquad \beta'_j=\beta_j-\beta_r\quad(j\ne r), \qquad \beta'_r=0. $$

Worked Example: Releveling a Three-Tier Coverage Predictor

A hypothetical model uses standard coverage as the reference, with coefficients \(\beta_{\text{enhanced}}=\log(1.25)\) and \(\beta_{\text{premium}}=\log(2)\). For one fixed profile, the standard-coverage odds are 0.40. Re-express the model using premium as the reference, and find the odds ratio for enhanced versus premium.

Method. Subtract the old premium coefficient from each nonreference coefficient, and add it to the old intercept. For the displayed profile, first calculate each category's odds to check the transformed comparisons.

The enhanced odds are \(0.40(1.25)=0.50\), and the premium odds are \(0.40(2)=0.80\). Therefore the enhanced-versus-premium odds ratio is \(0.50/0.80=0.625\). Equivalently, \(\exp(\log(1.25)-\log(2))=\exp(\log(0.625))=0.625\).

With premium as reference, the new enhanced coefficient is \(\log(1.25)-\log(2)=\log(0.625)\), while the new standard coefficient is \(0-\log(2)=\log(0.5)\). The new intercept is the old intercept plus \(\log(2)\). For a check, the standard-to-premium odds ratio is \(0.40/0.80=0.5\), matching \(\exp(\log(0.5))\); enhanced-to-premium is \(0.625\), matching its new coefficient after exponentiation.

The common mistake avoided is keeping the old coefficient labels after changing the reference. Coefficients are defined relative to the chosen reference; they must be transformed along with it.

Common Exam Traps and Interpretation Limits

A coefficient is a log-odds contrast, not an odds ratio. Exponentiating a single nonreference coefficient gives an odds ratio only against the reference. For a different comparison, use a contrast first. Also keep the comparison direction explicit: if the odds ratio for \(a\) versus \(b\) is \(R\), the ratio for \(b\) versus \(a\) is \(1/R\).

Do not describe an odds ratio as a fixed probability increase. The probability corresponding to a given odds ratio depends on the starting odds. In addition, the interpretation is conditional on the other predictors in the model being held fixed. A model association is not automatically a causal conclusion. These distinctions help keep the interpretation aligned with what the fitted logistic model actually specifies.

Key takeaway: Identify the reference level, assign it coefficient zero for the contrast, subtract the coefficient for the comparison level from the coefficient for the reference or other comparison level in the requested order, and exponentiate. Check the direction and describe the result as an odds ratio.

Check Your Understanding

For each problem, assume the stated coefficients come from a logistic model with no interactions, and hold all other predictors fixed. Identify the requested comparison before calculating.

  1. A model uses the central district as the reference. The coefficients are \(\beta_{\text{west}}=\log(1.5)\) and \(\beta_{\text{east}}=\log(0.75)\). Find the odds ratio for east versus west. (Answer: \(0.75/1.5=0.5000\).)
  2. A membership predictor has basic as its reference, with \(\beta_{\text{standard}}=\log(1.2)\) and \(\beta_{\text{premium}}=\log(2.4)\). Find the premium-versus-standard odds ratio and state which category has higher odds. (Answer: \(2.4/1.2=2.0000\); premium has twice the odds.)
  3. A hypothetical claim model uses the standard contract as reference. The bronze coefficient is \(\log(0.9)\), and the platinum coefficient is \(\log(1.8)\). Find the odds ratio for platinum versus bronze. (Answer: \(1.8/0.9=2.0000\).)
  4. For a profile, the reference-category probability is \(0.25\). The coefficients for categories A and B are \(\log(1.4)\) and \(\log(2.1)\), respectively. Find the odds ratio for B versus A and the fitted probability for B. (Answer: odds ratio \(2.1/1.4=1.5000\); reference odds \(0.25/0.75=1/3\), B odds \(2.1/3=0.7\), and B probability \(0.7/1.7=0.4118\).)
  5. A model originally uses R as the reference, with coefficients \(\beta_G=\log(1.6)\) and \(\beta_S=\log(2.4)\). Relevel the model using S as reference. Give the new G coefficient and the odds ratio for G versus S. (Answer: \(\log(1.6)-\log(2.4)=\log(2/3)\); odds ratio \(2/3=0.6667\).)
Clinical Biostats