Tutorials › Generalized Linear Mixed Models (GLMM) › Why Logistic Odds Ratios Change After Averaging

GLMM Versus GEE · Tutorial 119 of 698

Why Logistic Odds Ratios Change After Averaging

Learn why conditional and marginal logistic odds ratios can differ, how to calculate the difference, and why it does not by itself show confounding.

Intermediate 12 min read

What You'll Learn

  • Define conditional and marginal odds ratios for a binary outcome.
  • Derive why averaging over a prognostic covariate can move an odds ratio toward one.
  • Calculate standardized marginal odds ratios from stratum-specific risks.
  • Distinguish non-collapsibility from confounding due to covariate imbalance.
  • Choose and report an effect measure that matches the scientific question.
  • Recognize when a change in logistic coefficients reflects a change in estimand rather than a modeling error.

Why averaging can change an odds ratio

In a logistic model, a treatment coefficient often describes an odds ratio conditional on covariates: it compares outcomes for two treatment values while holding those covariates fixed. A population-level comparison may instead average predicted probabilities over a covariate distribution and then compare the resulting odds. These are different operations, and, for odds, they generally give different answers.

This difference is called non-collapsibility. It can occur when treatment groups have the same covariate distribution and there is no confounding by that covariate. Thus, a conditional odds ratio and an odds ratio calculated after averaging need not match even when both are correctly calculated and the model is correctly specified.

Definition: For a binary outcome \(Y\), the odds at probability \(p\) are \(p/(1-p)\). The odds ratio comparing \(A=1\) with \(A=0\), within covariate stratum \(Z=z\), is $$ \operatorname{OR}(z)= \frac{P(Y=1\mid A=1,Z=z)/P(Y=0\mid A=1,Z=z)} {P(Y=1\mid A=0,Z=z)/P(Y=0\mid A=0,Z=z)}. $$ A conditional odds ratio compares treatment values at fixed \(Z\). A marginal odds ratio first averages each treatment-specific outcome probability over a specified distribution of \(Z\), then calculates the odds ratio from those two averaged probabilities.

Logistic model and the two estimands

For a binary treatment indicator \(A\) and covariates \(Z\), consider the logistic model

$$ \operatorname{logit}\{P(Y=1\mid A,Z)\} =\beta_0+\beta_A A+\beta_Z Z. $$

Here \(\operatorname{logit}(p)=\log\{p/(1-p)\}\). The model assumes a linear predictor on the log-odds scale and, as written, no treatment-by-\(Z\) interaction. At fixed \(Z=z\), increasing \(A\) from 0 to 1 changes log odds by \(\beta_A\), so the conditional odds ratio is \(\exp(\beta_A)\), the same in every stratum.

To define a marginal comparison, choose a target distribution for \(Z\), with expectation denoted by \(E_Z\). Let \(p_a(z)=P(Y=1\mid A=a,Z=z)\). The standardized marginal probability under treatment value \(a\) is

$$ \bar p_a=E_Z\{p_a(Z)\}, \qquad \operatorname{OR}_{\mathrm{marg}} =\frac{\bar p_1/(1-\bar p_1)}{\bar p_0/(1-\bar p_0)}. $$

The target distribution must be stated: it could be the covariate distribution in a study population or a specified reference population. This standardization gives both treatment values the same distribution of \(Z\). It therefore separates averaging from differences in the composition of the observed treatment groups.

Assumptions for the comparison: The arithmetic below assumes that the stratum-specific probabilities are correctly specified, that the same target distribution of \(Z\) is used for both treatment values, and that probabilities are defined for the covariate strata being averaged. A causal interpretation additionally requires suitable causal assumptions, including consistency, positivity, and no unmeasured confounding for the treatment comparison. The distinction between conditional and marginal odds ratios is mathematical; it does not, by itself, establish a causal effect.

Why the marginal odds ratio is different

Suppose the conditional odds ratio is a constant \(\theta>1\). If the untreated risk in a stratum is \(p\), multiplying its odds by \(\theta\) gives the treated risk

$$ q(p)=\frac{\theta p}{1-p+\theta p} =\frac{\theta p}{1+(\theta-1)p}. $$

The marginal treated risk is \(E\{q(p)\}\), while the marginal untreated risk is \(E(p)\). In general, calculating \(q\) after averaging \(p\) is not the same as averaging \(q(p)\). This is the source of non-collapsibility for this setup.

1
Relate the two risks.
For \(\theta>1\), \(q(p)\ge p\), because \(q(p)-p=(\theta-1)p(1-p)/\{1+(\theta-1)p\}\ge0\). Thus the marginal treated risk exceeds the marginal untreated risk, provided the risks are nonzero and below one.
2
Use curvature.
For \(0<p<1\), \(q''(p)=-2\theta(\theta-1)/\{1+(\theta-1)p\}^3<0\). Therefore \(q\) is strictly concave, and Jensen's inequality gives \(E\{q(p)\}\le q\{E(p)\}\).
3
Compare odds.
Odds increase with probability. The first step makes the marginal odds ratio greater than 1; the second says the treated marginal risk is no larger than the risk obtained by applying the conditional odds ratio to the marginal untreated risk. Hence, when untreated risks vary, \(1<\operatorname{OR}_{\mathrm{marg}}<\theta\). Equality at the upper end holds when the untreated risk is constant across strata.

For a protective conditional odds ratio, the corresponding result is that the marginal odds ratio lies between that value and 1, under the same common-distribution setup. These results concern odds ratios. They do not say that every marginal effect measure must change in the same way.

Worked Example: A Conditional Odds Ratio of 2 Becomes 1.72

Consider a hypothetical population with two equally common covariate strata. The untreated risks are 0.10 in the lower-risk stratum and 0.50 in the higher-risk stratum. Suppose treatment doubles the odds in each stratum, so the conditional odds ratio is 2. Assume both treatment values are standardized to the same 50:50 stratum distribution.

In the lower-risk stratum, the treated risk is \(2(0.10)/\{0.90+2(0.10)\}=0.20/1.10=0.1818\). In the higher-risk stratum, it is \(2(0.50)/\{0.50+2(0.50)\}=1/1.50=0.6667\). These risks have treatment-to-control odds ratios of 2 within each stratum.

The standardized untreated risk is \(\bar p_0=(0.10+0.50)/2=0.3000\). The standardized treated risk is \(\bar p_1=(0.1818+0.6667)/2=0.4242\). Consequently,

$$ \operatorname{OR}_{\mathrm{marg}} =\frac{0.4242/(1-0.4242)}{0.3000/(1-0.3000)} =\frac{0.7368}{0.4286} =1.719. $$

The conditional odds ratio is 2, while the marginal odds ratio is about 1.72. This is not a calculation error: the two numbers answer different questions. The conditional comparison holds stratum fixed; the marginal comparison combines the risks first and then forms the odds ratio.

Non-collapsibility is not confounding

Confounding and non-collapsibility can both make a crude odds ratio differ from a covariate-adjusted odds ratio, but they are not the same phenomenon. Non-collapsibility arises from the odds-ratio scale when outcome risks vary across strata, even if the treatment groups share the same covariate distribution. Confounding concerns an imbalance in covariates associated with both treatment and outcome that can distort a treatment comparison. Whether that distortion has a causal interpretation depends on the study design and causal assumptions.

The next example deliberately gives the treatment groups different covariate distributions. Its unadjusted comparison combines the stratum-specific treatment effect with a change in population composition. Comparing it with a standardized result makes the distinction concrete.

Worked Example: Covariate Imbalance Adds a Composition Difference

Suppose the same hypothetical stratum-specific risks apply: untreated risks are 0.10 and 0.50, and treatment doubles the odds in each stratum, giving treated risks 0.1818 and 0.6667. Now suppose 20% of the untreated group but 80% of the treated group is in the higher-risk stratum.

The observed untreated risk is \(0.80(0.10)+0.20(0.50)=0.1800\). The observed treated risk is \(0.20(0.1818)+0.80(0.6667)=0.5697\). The odds ratio comparing these observed groups is

$$ \frac{0.5697/(1-0.5697)}{0.1800/(1-0.1800)} =\frac{1.324}{0.2195} \approx 6.031. $$

This observed-group odds ratio is much larger than 2. It does not estimate the common within-stratum odds ratio: the groups differ in their proportions from the higher-risk stratum. Standardizing both treatment values to the same 50:50 distribution gives the earlier marginal odds ratio, 1.719—not 6.031. The difference between 2 and 1.719 remains even under common standardization and is non-collapsibility; the additional difference in the observed-group comparison reflects the different covariate distributions. Calling that latter difference confounding requires a causal question and the relevant causal assumptions, not just a comparison of coefficients.

Worked Example: Less Risk Variation, Less Non-Collapsibility

Take two equally weighted strata with untreated risks 0.10 and 0.20, and again let the conditional odds ratio be 2. The treated risks are \(0.20/1.10=0.1818\) and \(0.40/1.20=0.3333\). The standardized risks are

$$ \bar p_0=(0.10+0.20)/2=0.1500, \qquad \bar p_1=(0.1818+0.3333)/2=0.2576. $$

Thus the marginal odds ratio is

$$ \frac{0.2576/0.7424}{0.1500/0.8500} =\frac{0.3469}{0.1765} \approx 1.966. $$

Here the marginal odds ratio is closer to 2 than in the first example because the untreated risks vary less across strata. The conditional odds ratio is still exactly 2. The size of the difference depends on the outcome-risk distribution as well as on the conditional effect; it is not a fixed correction factor.

Which comparison should be reported?

Neither estimand is universally preferable. A conditional odds ratio is appropriate when the scientific question concerns comparisons at fixed covariate values, or when the logistic model's conditional parameter is the target. A marginal odds ratio is appropriate when the target is a population-level comparison formed from treatment-specific risks averaged over a stated population. For a marginal result, report the target distribution and the standardized risks as well as their odds ratio when possible.

QuantityHow it is formedQuestion it answers
Conditional odds ratioCompare odds at fixed covariate valuesHow do the odds compare within the same covariate stratum?
Marginal odds ratioAverage risks over a common target distribution, then compare oddsHow do population-level odds compare after standardization?
Observed-group odds ratioCompare risks in the groups as observed, with their actual covariate distributionsHow do the observed groups compare without standardizing their composition?

Other effect measures can make a population-level result easier to interpret. For example, if the risk difference is constant across strata, averaging the two risks over the same distribution preserves that risk difference. A constant risk ratio also preserves its value under common standardization. Such properties do not make odds ratios wrong; they reinforce the need to name the effect measure and the population to which it refers.

Diagnostics and common pitfalls

A difference between conditional and marginal odds ratios is not, on its own, evidence of poor model fit. Instead, inspect whether the logistic model is appropriate for the intended conditional comparison and whether the reported marginal comparison uses the intended target distribution. In particular, assess whether the model needs a treatment-by-covariate interaction: if the treatment effect varies across strata, there is no single common conditional odds ratio to compare with the marginal one.

For a practical check, calculate treatment-specific predicted risks within relevant covariate strata, average those risks using stated common weights, and then calculate the marginal odds ratio. Separately inspect the covariate distributions across treatment groups. A large difference in those distributions warns that an observed-group comparison and a standardized comparison answer different questions. Sparse or empty strata also matter: if a treatment value is absent in a stratum, the corresponding comparison may rely on extrapolation rather than observed support.

  • Mistake: “The adjusted odds ratio changed, so there must be confounding.” A change can occur through non-collapsibility even with a common covariate distribution. Compare standardized risks and covariate distributions before attributing the change to confounding.
  • Mistake: “The marginal odds ratio should equal the average of the stratum-specific odds ratios.” Odds ratios are not averaged that way. Average the probabilities first, then form the marginal odds ratio.
  • Mistake: “The marginal odds ratio is the conditional coefficient with a different label.” The conditional coefficient is \(\beta_A\); the marginal odds ratio is based on averaged probabilities. State which quantity is being reported.
  • Mistake: “Non-collapsibility makes the conditional estimate biased.” It does not: the conditional and marginal estimands differ. Bias is defined relative to a specified target, so one estimate cannot be called biased without naming that target.

Non-collapsibility is therefore important when translating a logistic-model coefficient into a population-level statement. It is a property of the odds-ratio scale, not a defect that can be fixed by simply dropping covariates. Removing covariates changes the model and may introduce confounding or other problems; it does not automatically produce the desired marginal estimand.

Check Your Understanding

Answer each question, then compare with the solutions below.

  1. A logistic model has a treatment coefficient of \(\log(1.8)\). What is the conditional odds ratio, and what is held fixed in its interpretation?
  2. With a common covariate distribution and a constant conditional odds ratio above 1, why can the marginal odds ratio be smaller?
  3. Does a difference between an adjusted and an unadjusted odds ratio prove confounding? Explain.
  4. Suppose the untreated risk is the same in every covariate stratum and the conditional odds ratio is constant. What is the standardized marginal odds ratio?
  5. Why should a marginal odds ratio be accompanied by the target covariate distribution used to calculate it?

Solutions. (1) The conditional odds ratio is \(\exp\{\log(1.8)\}=1.8\); the comparison holds the model covariates fixed. (2) The logistic transformation is nonlinear: under a common distribution, averaging the stratum-specific risks and then taking odds generally attenuates the odds ratio toward 1. (3) No. Non-collapsibility can change the odds ratio even without covariate imbalance; confounding requires additional evidence and, for a causal claim, appropriate assumptions. (4) It equals the conditional odds ratio, because applying the same odds ratio to the same untreated risk in each stratum gives the same treated risk in every stratum. (5) Different target distributions can give different averaged risks and thus different marginal odds ratios, so the population being described must be clear.

Clinical Biostats