Why an Odds Ratio Can Depend on Another Predictor
In a logistic regression without a product term, the model assigns the same conditional odds ratio to a given change in a predictor at every fixed value of the other covariates. An interaction term relaxes that restriction: it allows the odds ratio for one predictor to vary with another predictor. This is useful when, for example, a treatment’s association with an outcome may differ by age or by a binary subgroup.
The phrase conditional odds ratio matters. It compares the odds of the outcome at two values of one predictor while holding the other predictor fixed. In a model with an interaction, that fixed value helps determine the odds ratio itself. The coefficient of the product term describes how the conditional odds ratio changes; it is not, by itself, the odds ratio for either predictor.
The Logistic Model With a Product Term
Let \(Y\) be a binary outcome, and let \(X\) and \(Z\) be predictors represented numerically. Consider the fitted logistic model
Here \(\operatorname{logit}(p)=\log\{p/(1-p)\}\), and \(xz\) is the product of the two predictor values. The model is assumed to have finite coefficients and to describe conditional probabilities strictly between zero and one. The coefficient interpretations below are algebraic consequences of this specified model; they do not require the coefficients to have been estimated by a particular method.
The odds at a predictor profile are the conditional probability of \(Y=1\) divided by the conditional probability of \(Y=0\). Since the logit is the logarithm of those odds, subtracting two model linear predictors gives the log of their odds ratio. The product term therefore contributes to the comparison whenever the value of \(Z\) is not zero.
Deriving the Conditional Odds Ratio
Proof. Write \(\eta(x,z)=\beta_0+\beta_1x+\beta_2z+\beta_3xz\) for the model’s linear predictor. At fixed \(z\), the log odds at \(x\) equal \(\eta(x,z)\). Thus the log of the conditional odds ratio for \(x_1\) versus \(x_0\) is
Exponentiating this difference gives the stated odds ratio. Setting \(x_1-x_0=1\) gives the one-unit result. \(\square\)
When \(X\) is binary and coded \(0,1\), the one-unit comparison is the \(X=1\) versus \(X=0\) odds ratio. When \(X\) is continuous, the same formula applies to any chosen change \(x_1-x_0\), such as five units. If \(Z=0\), the one-unit odds ratio for \(X\) is \(\exp(\beta_1)\); at another value \(z\), it is \(\exp(\beta_1+\beta_3z)\).
What the Product Coefficient Measures
Proof. By the preceding result, the conditional odds ratio at \(z\) is \(\exp\{(x_1-x_0)(\beta_1+\beta_3z)\}\). Divide its value at \(z_1\) by its value at \(z_0\):
For one-unit changes in both predictors, the differences are each one, so the ratio reduces to \(\exp(\beta_3)\). This proves the result. \(\square\)
If \(X\) and \(Z\) are both binary and coded \(0,1\), \(\exp(\beta_3)\) is the ratio of the \(X=1\) versus \(X=0\) odds ratio in the \(Z=1\) stratum to that in the \(Z=0\) stratum. Equivalently, \(\beta_3\) is the difference between those two stratum-specific log odds ratios. A positive \(\beta_3\) means the \(X\) odds ratio is larger at \(Z=1\) than at \(Z=0\); a negative \(\beta_3\) means it is smaller.
The model is symmetric in the two predictors: at fixed \(X=x\), the one-unit odds ratio for \(Z\) is \(\exp(\beta_2+\beta_3x)\). The main-effect coefficients are therefore conditional effects at the other predictor’s value zero. If zero is not a meaningful or observed value, those main-effect interpretations may be inconvenient, even though the model’s comparisons at specified predictor values remain defined.
Calculating Stratum-Specific Odds Ratios
Worked Example: A Binary Predictor and a Binary Modifier
Suppose \(X\) is a binary treatment indicator and \(Z\) is a binary subgroup indicator, both coded \(0,1\). A fitted model has \(\hat\beta_1=0.70\) and \(\hat\beta_3=-0.40\). Calculate the treatment odds ratio in each subgroup and compare them.
At \(Z=0\), the treatment comparison is \(X=1\) versus \(X=0\), so the conditional odds ratio is \[ \exp(\hat\beta_1+\hat\beta_3\cdot 0) =\exp(0.70)\approx 2.01. \]
At \(Z=1\), it is \[ \exp(\hat\beta_1+\hat\beta_3\cdot 1) =\exp(0.70-0.40) =\exp(0.30)\approx 1.35. \]
The ratio of the subgroup-one treatment odds ratio to the subgroup-zero treatment odds ratio is \(1.35/2.01\), approximately \(0.67\). Directly, \(\exp(\hat\beta_3)=\exp(-0.40)\approx0.67\). Thus the treatment odds ratio is smaller in the \(Z=1\) subgroup on the odds-ratio scale. The value \(\exp(-0.40)\) is the ratio between the two treatment odds ratios, not either subgroup’s treatment odds ratio.
Worked Example: A Continuous Predictor With a Binary Modifier
Let \(X\) be a continuous dose measured in milligrams and let \(Z\) indicate subgroup membership, coded \(0,1\). In a fitted model, \(\hat\beta_1=0.12\) and \(\hat\beta_3=0.08\). Find the odds ratio for a five-milligram increase in each subgroup.
For \(Z=0\), the change in \(X\) is \(5\), so the odds ratio is \[ \exp\{5(0.12+0.08\cdot0)\} =\exp(0.60)\approx1.82. \]
For \(Z=1\), it is \[ \exp\{5(0.12+0.08\cdot1)\} =\exp(1.00)\approx2.72. \]
The ratio of these odds ratios is \(\exp(1.00)/\exp(0.60)=\exp(0.40)\approx1.49\). This also follows from the theorem: the predictor change is five units and the modifier changes by one, giving \(\exp\{0.08(5)(1)\}\approx1.49\). The units matter: these calculations describe a five-milligram contrast, not an unspecified change in dose.
Worked Example: A Binary Predictor Modified by Age
Suppose \(X\) is a binary exposure coded \(0,1\), and age \(Z\) is measured in years with zero corresponding to age 50. A fitted model has \(\hat\beta_1=0.80\) and \(\hat\beta_3=-0.025\). Calculate the exposure odds ratio at ages 50 and 60.
At age 50, \(z=0\), so the exposure odds ratio is \[ \exp(0.80-0.025\cdot0)=\exp(0.80)\approx2.23. \]
At age 60, \(z=10\), so the odds ratio is \[ \exp(0.80-0.025\cdot10) =\exp(0.55)\approx1.73. \]
The ratio of the age-60 odds ratio to the age-50 odds ratio is \(\exp(-0.25)\approx0.78\), consistent with a ten-unit age change and a one-unit exposure contrast: \(\exp\{\hat\beta_3(1)(10)\}\). The negative interaction coefficient indicates that the exposure odds ratio decreases as age increases in this model. Centering age at 50 makes \(\hat\beta_1\) the exposure log odds ratio at age 50; it does not change the fitted comparisons at a given age.
Coding, Interpretation, and a Common Pitfall
An odds ratio from an interaction model is incomplete unless its comparison and conditioning value are stated. For example, “the treatment odds ratio is 2.01” is not generally enough when treatment interacts with subgroup. A clear interpretation identifies the outcome, the two treatment values, and the subgroup or modifier value being held fixed.
The zero point and units of a predictor affect the meaning of the main-effect coefficients. If a continuous modifier is recentered, its zero corresponds to a different reference value, so the coefficient for \(X\) then represents the \(X\) odds ratio at that new reference. Likewise, changing units changes the numerical size of a per-unit interaction coefficient. These coding choices do not alter the model’s predictions when the same fitted relationship is expressed consistently.
Common mistake: interpreting \(\exp(\beta_3)\) as the odds ratio for \(X\). With two binary predictors coded \(0,1\), \(\exp(\beta_3)\) is instead the ratio of the \(X\) odds ratio at \(Z=1\) to the \(X\) odds ratio at \(Z=0\). The correction is to substitute the specified \(z\) into \(\exp(\beta_1+\beta_3z)\) to obtain the one-unit \(X\) odds ratio. For continuous predictors, also multiply by the actual predictor change before exponentiating.
Finally, the interaction described here is on the log-odds scale. A zero product coefficient means the conditional odds ratio for a given \(X\) change does not vary with \(Z\) in this model. It does not assert that probability differences are constant across values of \(Z\), nor does it by itself describe a comparison that averages over \(Z\).
Check Your Understanding
Use the model and formulas above to answer these questions.
- For binary \(X,Z\) coded \(0,1\), what does \(\exp(\beta_3)\) compare?
- If \(X\) is continuous, how does the conditional odds ratio for a three-unit increase differ from the one-unit odds ratio?
- In a model with \(\beta_1=0.5\) and \(\beta_3=0.2\), what is the one-unit \(X\) odds ratio at \(Z=2\)?
- For a binary \(X\) and continuous \(Z\), what does \(\beta_1\) represent when \(Z\) has been centered at 40?
- Why is it incorrect to call \(\exp(\beta_3)\) the treatment odds ratio in a binary-by-binary interaction model?