Interaction Terms in Logistic Regression: Other Covariates
A covariate outside the interaction keeps its ordinary adjusted meaning. Here is the algebra that shows why, a way to verify it in R, and the cases where the reassurance stops.

You fit glm(Y ~ X * Z + C1 + C2, family = binomial). R expands that to X + Z + X:Z + C1 + C2. You already know that the coefficients on X and Z are no longer main effects: each is the effect of that variable when the other equals 0. The question on Cross Validated asks about the rest of the model. Does that caveat spread to C1, which is not in the interaction?
The practical stakes are reporting. If the caveat spreads, exp(coef(fit)['C1']) can no longer be quoted as an adjusted odds ratio, and its p-value no longer tests the usual null. If it does not spread, you can report C1 as you would in a model with no interaction.
The answer is that it does not spread. C1 keeps its ordinary meaning: a conditional effect, adjusted for every other term in the model, interaction included. The rest of this article shows why, how to confirm it yourself, and where the conclusion stops holding.
What the interaction actually changes
Once X:Z is in the model, the log-odds slope for X depends on the value of Z, and the slope for Z depends on the value of X. The coefficient printed beside X is the slope at Z = 0. The coefficient beside Z is the slope at X = 0. Neither is an average or overall effect, which is why they should not be read as main effects.
Both of those coefficients are defined only relative to the other member of the pair. C1 is not part of that pair, so nothing in its definition refers to X or Z.
The algebra: why C1 is untouched
The most useful worked example is the one in this answer, which summarises an example from Hosmer and Lemeshow. The setup is an indicator X1 for sex (1 if female), a continuous Z for age, their product, and a separate covariate X2, the patient's BMI. The outcome is coronary heart disease. On the logit scale, assuming age is linear in both sexes:
logit(Y) = alpha + beta1*X1 + gamma*Z + delta*(X1*Z) + beta2*X2Substitute each value of X1 and rearrange:
Female: logit(Y) = (alpha + beta1) + (gamma + delta)*Z + beta2*X2
Male: logit(Y) = alpha + gamma*Z + beta2*X2The two sexes get a different intercept and a different age slope. The BMI term, beta2*X2, is identical in both lines. A one-unit change in BMI moves the log-odds by beta2 for women and for men, at any age. The interaction reshapes the terms it contains and leaves the others alone.
Checking it in R
If you would rather not trust the algebra, a more empirical route is to plug in different values of the predictors and compare predictions. Fit the model, then predict on the link scale at two values of C1 that differ by one unit, holding everything else fixed, and repeat at several combinations of X and Z:
fit <- glm(Y ~ X * Z + C1 + C2, family = binomial, data = d)
base <- data.frame(X = 0, Z = 0, C1 = 0, C2 = 0)
up <- transform(base, C1 = 1)
predict(fit, up, type = 'link') - predict(fit, base, type = 'link')
coef(fit)['C1']The two numbers match. Change X and Z in base to any other values and the difference stays equal to the C1 coefficient. Do the same for X and the difference changes with Z, which is the interaction at work. The contrast is the quickest way to see which coefficients are conditional on other variables' values and which are not.
Exponentiating: where the messiness lives
On the logit scale the picture above is clean. Exponentiating complicates things for the variables in the interaction, because an odds ratio for X or Z has to be computed at specific values of the other member of the pair. There is no single odds ratio for X in this model.
The additional covariate is not involved in that. exp(beta_C1) is a single odds ratio, valid at every value of X and Z. It is still conditional on the rest of the terms in the model, so the report should say it comes from a model containing an interaction. The p-value attached to C1 tests that its coefficient is zero given everything else in the model, which is the same kind of null as in a model without an interaction.
Where to read it up
The asker wanted a citation, and one answer admitted not knowing a book that states this directly, suggesting the algebra or plugging in values instead. The longer answer points to Fox, Applied Regression Analysis and Generalized Linear Models, Chapter 7, which covers interpreting coefficients in the presence of interactions and quotes Nelder's principle of marginality. The discussion there is framed around OLS with dummy variables, but the principle applies across generalized linear models. For logistic regression specifically, it recommends Hosmer and Lemeshow, Applied Logistic Regression, pp. 64 to 77, as giving much more detail. Weisberg's Applied Linear Regression is also on that list for general regression and GLM issues.
Where this does not hold, and what to watch for
- C1 in its own interaction. Everything above relies on
C1appearing in no product term. AddC1:Zand it joins the conditional-coefficient group. - The linearity assumption. The worked example assumes age is linear on the log-odds scale in both groups. If it is not, the clean substitution step no longer describes your model.
- Conditional still means conditional.
C1's odds ratio is adjusted for the other terms, so it need not equal what a simpler model would give. Report it with that in mind. - Reading the interacting terms. In the example,
gammais the age slope for the reference group (X1 = 0), not for everyone. The female slope isgamma + delta. - Whether to report C1 at all. Often a covariate is in the model only to reduce confounding of the exposure effect. One answer treats the question of interpreting such covariates as advanced territory.
This article draws on Does an interaction term affect the interpretation of the other covariates? and answers to it (1, 2), on the Stack Exchange network, licensed under CC BY-SA 4.0.
- #glm
- #interaction
- #logistic regression
- #odds ratio
- #r
- #regression



Comments