A Repeated Binary Outcome Model
Suppose a clinical study records whether each participant experiences an adverse event at baseline and at a later visit. The event status is binary, but the scientific questions concern its probability at each visit: how does that probability change over time, and does the change differ between treatment groups? A marginal mean model answers these questions by modeling the event probability in the population at each combination of treatment and time.
Let \(Y_{ij}\) be the binary outcome for participant \(i\) at visit \(j\), where \(Y_{ij}=1\) denotes the event and \(Y_{ij}=0\) denotes no event. Let \(A_i=1\) indicate treatment and \(A_i=0\) indicate control. For two visits, code baseline as \(t_{ij}=0\) and follow-up as \(t_{ij}=1\). The marginal mean is \(\mu_{ij}=E[Y_{ij}\mid A_i,t_{ij}]\), which for a binary variable is the event probability.
The term “marginal” matters: the probability in this model is a population mean for the stated covariate values, not an individual-specific probability conditioned on an unobserved participant effect. Repeated outcomes may be dependent, but that dependence is a separate feature from the mean specification.
Reading the Four Treatment-Time Cells
With binary treatment and two visits, the model gives four linear predictors. Writing them out is a reliable way to see what each coefficient does.
The first subscript denotes treatment status and the second denotes time. The treatment effect on the log-odds scale is therefore allowed to differ by visit. Without the interaction, \(\beta_3=0\), the treatment-control log-odds contrast would be constant over time.
To verify this, subtract the control linear predictor from the treatment linear predictor at each visit. At baseline the difference is \(\eta_{10}-\eta_{00}=\beta_2\); at follow-up it is \(\eta_{11}-\eta_{01}=\beta_2+\beta_3\). Since exponentiating a log-odds difference gives an odds ratio, the two treatment odds ratios are \(e^{\beta_2}\) and \(e^{\beta_2+\beta_3}\). Their ratio is \(e^{\beta_2+\beta_3}/e^{\beta_2}=e^{\beta_3}\). \(\square\)
Worked Example: Interpreting the Interaction
Suppose the fitted coefficients are \(\hat\beta_0=-1.5\), \(\hat\beta_1=0.5\), \(\hat\beta_2=-0.4\), and \(\hat\beta_3=-0.6\). The outcome is an adverse event, so a negative treatment contrast indicates lower event odds in the treatment group.
At baseline, the control log odds are \(-1.5\), and the treatment log odds are \(-1.5-0.4=-1.9\). The baseline treatment-control log-odds contrast is \(-0.4\), corresponding to an odds ratio of \(e^{-0.4}\approx0.6703\).
At follow-up, the control log odds are \(-1.5+0.5=-1.0\), and the treatment log odds are \(-1.5+0.5-0.4-0.6=-2.0\). The follow-up treatment-control contrast is \(-1.0\), corresponding to an odds ratio of \(e^{-1}\approx0.3679\). The interaction is \(-0.6\), so the ratio of those odds ratios is \(e^{-0.6}\approx0.5488\). The treatment odds ratio is lower at follow-up than at baseline.
This interpretation concerns odds, not probabilities. To describe changes in event probability, first calculate the fitted probabilities and then form contrasts on that scale.
From Linear Predictors to Fitted Probabilities
The inverse-logit function converts a linear predictor \(\eta\) into a probability:
This conversion is essential when the target is an event risk, risk difference, or population-average probability. A coefficient is not itself a probability change. Because the conversion is nonlinear, the same log-odds contrast can correspond to different probability differences at different starting risks.
Worked Example: Calculating the Four Fitted Risks
Continue with the coefficient estimates in the preceding example. Calculate each fitted probability by first forming its linear predictor and then applying the inverse logit.
Control, baseline: \(\hat\eta_{00}=-1.5\). Hence \[ \hat\mu_{00}=\frac{e^{-1.5}}{1+e^{-1.5}} =\frac{0.2231302}{1.2231302}\approx0.1824. \] The fitted event risk is about 18.24%.
Control, follow-up: \(\hat\eta_{01}=-1.5+0.5=-1.0\). Thus \[ \hat\mu_{01}=\frac{e^{-1}}{1+e^{-1}} =\frac{0.3678794}{1.3678794}\approx0.2689. \]
Treatment, baseline: \(\hat\eta_{10}=-1.5-0.4=-1.9\). Thus \[ \hat\mu_{10}=\frac{e^{-1.9}}{1+e^{-1.9}} =\frac{0.1495686}{1.1495686}\approx0.1301. \]
Treatment, follow-up: \(\hat\eta_{11}=-1.5+0.5-0.4-0.6=-2.0\). Thus \[ \hat\mu_{11}=\frac{e^{-2}}{1+e^{-2}} =\frac{0.1353353}{1.1353353}\approx0.1192. \] At this follow-up visit the fitted treatment risk is about 11.92%, compared with 26.89% in control.
Each displayed probability follows from the corresponding cell predictor; the four values can be checked by substituting them back into the fitted odds. For example, \(0.1192/(1-0.1192)\approx0.1353=e^{-2}\).
The coefficients describe differences in log odds, whereas these fitted probabilities describe the response scale. In particular, the interaction coefficient does not generally equal a difference-in-differences of risks. One must calculate the four probabilities and then take the desired risk contrasts.
Risk Contrasts and Their Interpretation
At each visit, the treatment risk difference is the treatment probability minus the control probability. For the fitted model above, the baseline contrast is \(\hat\mu_{10}-\hat\mu_{00}=0.13010847-0.18242552=-0.05231705\), approximately a 5.23 percentage-point lower risk under treatment. At follow-up it is \(\hat\mu_{11}-\hat\mu_{01}=0.11920292-0.26894142=-0.14973850\), approximately a 14.97 percentage-point lower risk.
The time change in the treatment risk difference is consequently \(-0.14973850-(-0.05231705)=-0.09742145\), about a 9.74 percentage-point greater reduction in risk difference by follow-up. This response-scale contrast is different from \(\beta_3=-0.6\), which is an interaction on the log-odds scale.
Worked Example: Standardizing Across a Target Population
Consider a model that also includes a binary baseline risk stratum \(X\): \[ \operatorname{logit}\{\mu(A,t,X)\} =\beta_0+\beta_1t+\beta_2A+\beta_3At+\beta_4X. \] Suppose \(\beta_0=0\), \(\beta_1=\log 3\), \(\beta_2=\log 2\), \(\beta_3=-\log 3\), and \(\beta_4=\log 2\). The target population has \(75\%\) with \(X=0\) and \(25\%\) with \(X=1\). Calculate the standardized treatment risk difference at both visits.
At baseline and \(X=0\), control has odds \(1\), hence risk \(1/2\); treatment has odds \(2\), hence risk \(2/3\). The risk difference is \(2/3-1/2=1/6\). For \(X=1\), the control odds double to \(2\), giving risk \(2/3\); treatment odds are \(4\), giving risk \(4/5\). The difference is \(4/5-2/3=2/15\). Therefore the baseline standardized contrast is \[ 0.75(1/6)+0.25(2/15)=1/8+1/30=19/120\approx0.1583. \]
At follow-up, the control odds are \(3\) for \(X=0\), giving risk \(3/4\); treatment odds are \(3\times2\times(1/3)=2\), giving risk \(2/3\). The stratum-specific difference is \(2/3-3/4=-1/12\). For \(X=1\), control odds are \(6\), giving risk \(6/7\), while treatment odds are \(6\times2\times(1/3)=4\), giving risk \(4/5\). The difference is \(4/5-6/7=-2/35\). The follow-up standardized contrast is \[ 0.75(-1/12)+0.25(-2/35)=-1/16-1/70=-43/560\approx-0.0768. \]
Thus, for this target population, the fitted treatment event risk is about 15.83 percentage points higher at baseline and 7.68 percentage points lower at follow-up. These are standardized risk differences, not the model’s log-odds coefficients. The calculation uses the same target proportions in both treatment groups, so the contrast compares predictions for a common population composition.
Common Mistakes and Practical Checks
- Reading a logit coefficient as a percentage-point change. A coefficient changes log odds. Apply the inverse logit to obtain risks, then subtract risks to get a risk difference.
- Ignoring the interaction when interpreting treatment effects. With \(A_it_{ij}\) in the model, the treatment log-odds contrast is \(\beta_2\) at baseline and \(\beta_2+\beta_3\) at follow-up.
- Calling a coefficient-scale interaction a risk-scale interaction. The interaction \(\beta_3\) is a difference in log-odds contrasts. A risk-scale difference-in-differences must be calculated from all four fitted probabilities.
- Changing the target population without noticing. A standardized contrast depends on the chosen stratum weights. State the target population and use its weights for both treatment groups.
- Assuming the mean model specifies within-participant dependence. It specifies the marginal probabilities. It does not, on its own, say how strongly repeated outcomes from one participant are associated.
A disciplined calculation proceeds from the model to the cell predictors, from predictors to fitted probabilities, and only then to the response-scale contrast. When standardizing, add the final step of averaging those probabilities over a clearly stated target distribution.
Check Your Understanding
Use the model definition and worked calculations to answer these questions.
- In the model with treatment-by-time interaction, what is the treatment-control log-odds contrast at baseline and at follow-up?
- What does \(e^{\beta_3}\) represent, and why is it not generally a risk difference?
- For the fitted coefficients \((-1.5,0.5,-0.4,-0.6)\), calculate the baseline treatment risk difference from the fitted probabilities.
- Why must a response-scale difference-in-differences be calculated from four fitted probabilities rather than read directly from \(\beta_3\)?
- If the target population’s stratum proportions change, which part of a standardized treatment contrast can change even when the fitted model coefficients stay fixed?