Tutorials › Biostatistics › Analysis of Longitudinal Binary Outcomes

Longitudinal & Repeated Measures Analysis

Analysis of Longitudinal Binary Outcomes

A practical guide to analyzing repeated binary outcomes in clinical research, including generalized estimating equations, generalized linear mixed models, marginal versus subject-specific effects, covariance structures, missing data, interpretation of odds ratios, and implementation in R and SAS.

Advanced 18 min read

What You'll Learn

  • Why ordinary logistic regression is inadequate for repeated binary outcomes
  • How GEE accounts for within-subject correlation
  • How GLMMs produce subject-specific interpretations
  • How to choose an appropriate working correlation structure
  • How to interpret treatment, time, and treatment-by-time effects
  • How to implement longitudinal binary models in R and SAS

Introduction

Clinical studies frequently measure the same binary outcome repeatedly over time. Examples include whether a patient is in remission, whether a symptom has resolved, whether a patient experiences an adverse event by a particular visit, or whether a prespecified clinical response has been achieved.

Suppose each patient is assessed at baseline, Week 4, Week 8, and Week 12. At every visit the outcome is either 0 or 1.

The resulting data are longitudinal binary data because the outcome is binary and multiple observations come from the same individual.

The central statistical complication is that observations from the same patient are generally correlated.

Key idea: Repeated binary observations from the same patient are not independent. Longitudinal methods such as GEE and generalized linear mixed models explicitly account for this within-subject dependence.

A Simple Example

Consider a clinical trial comparing an experimental treatment with placebo. Suppose the endpoint is whether the patient has achieved clinical response at each follow-up visit.

Patient Treatment Week 4 Week 8 Week 12
001 Active 0 1 1
002 Active 1 1 1
003 Active 0 0 1
004 Placebo 0 0 0
005 Placebo 1 0 0

Patient 001 contributes three observations, but those observations should not be treated as if they came from three unrelated patients.

The probability of response at Week 8 for Patient 001 is likely related to their response status at Week 4.

This dependence is the defining feature of the longitudinal problem.

Why Ordinary Logistic Regression Is Not Enough

A standard logistic regression model assumes independent observations.

For an observation \(Y_i\), a conventional logistic model is:

$$ \operatorname{logit}\{P(Y_i=1)\} = \beta_0+\beta_1X_i $$

If the same patient contributes multiple observations, however, the independence assumption is violated.

For example, if each of 100 patients contributes four visits, there are 400 observations but only 100 independent subjects.

Common mistake: Simply stacking repeated observations into a standard logistic regression does not solve the longitudinal problem. The coefficient estimates may still be interpretable under some circumstances, but the usual standard errors and inference are generally inappropriate because the repeated observations are correlated.

Three Ways to Think About Longitudinal Binary Data

There are three broad approaches commonly encountered in clinical research:

1
Marginal models: Generalized estimating equations estimate population-averaged effects.
2
Subject-specific models: Generalized linear mixed models incorporate patient-level random effects.
3
Simplified approaches: Methods such as a single selected post-baseline visit or responder analysis at one prespecified time point may be appropriate when justified by the estimand and study objective.

For genuinely longitudinal inference, GEE and GLMM are the two major modeling frameworks to understand.

The Binary Outcome Model

Let:

  • \(Y_{ij}\) = binary outcome for subject \(i\) at visit \(j\)
  • \(p_{ij}=P(Y_{ij}=1)\)
  • \(X_i\) = treatment indicator
  • \(t_j\) = visit or time
  • \(X_i t_j\) = treatment-by-time interaction

A common logistic mean model is:

$$ \operatorname{logit}(p_{ij}) = \beta_0 + \beta_1 X_i + \beta_2 t_j + \beta_3 X_i t_j $$

The model can be expanded to include baseline covariates, stratification factors, disease severity, region, or other prespecified prognostic variables.

What Does the Logit Mean?

The logit transformation converts a probability between 0 and 1 into an unbounded scale:

$$ \operatorname{logit}(p) = \log\left(\frac{p}{1-p}\right) $$

The quantity:

$$ \frac{p}{1-p} $$

is the odds of response.

Logistic regression models the logarithm of the odds.

Why Time Matters

Longitudinal clinical outcomes frequently change over time.

For example, response might increase as patients receive treatment:

Visit Active Response Placebo Response
Week 4 30% 20%
Week 8 50% 30%
Week 12 65% 40%

The treatment effect is therefore not necessarily constant over time.

This is why a longitudinal model often includes a treatment-by-time interaction.

Treatment-by-Time Interaction

The interaction term is:

$$ \beta_3 X_i t_j $$

It asks whether the treatment effect changes over time.

If the interaction is statistically and clinically important, reporting only one overall treatment odds ratio may hide an important feature of the data.

Interpretation: A significant treatment-by-time interaction means that the treatment effect depends on the visit. Treatment effects should then generally be presented separately by clinically relevant time point rather than summarized by a single overall effect.

Generalized Estimating Equations

Generalized estimating equations, or GEE, extend generalized linear models to correlated observations.

The mean model describes the expected response probability, while a working correlation matrix describes the association among repeated observations from the same subject.

The estimating equation can be written conceptually as:

$$ \sum_i D_i^{T} V_i^{-1} (Y_i-\mu_i) = 0 $$

where:

  • \(Y_i\) is the vector of repeated outcomes for subject \(i\)
  • \(\mu_i\) is the corresponding vector of fitted means
  • \(D_i\) contains derivatives of the mean with respect to the model parameters
  • \(V_i\) is the working covariance matrix

The important practical point is that GEE accounts for the repeated nature of the observations when estimating the regression parameters and their uncertainty.

Population-Averaged Interpretation

GEE produces a population-averaged, or marginal, interpretation.

Suppose the treatment coefficient is \(\beta_1\).

The corresponding odds ratio is:

$$ OR=e^{\beta_1} $$

The interpretation is approximately: the ratio of the odds of response for treated versus control subjects at the population level, conditional on the variables included in the model.

This is particularly attractive when the scientific question concerns the average treatment effect across the target population.

Generalized Linear Mixed Models

A generalized linear mixed model, or GLMM, handles within-subject correlation by introducing random effects.

For example, a random-intercept logistic model is:

$$ \operatorname{logit}(p_{ij}) = \beta_0 + \beta_1X_i + \beta_2t_j + \beta_3X_it_j + b_i $$

where:

$$ b_i\sim N(0,\sigma_b^2) $$

The random intercept \(b_i\) allows different patients to have different underlying propensities for response.

Why Random Intercepts Make Sense

Consider two patients receiving exactly the same treatment.

One patient may have a generally high probability of responding, while another may have a much lower probability.

A random intercept allows the model to represent this patient-to-patient heterogeneity.

The model therefore recognizes that repeated observations from the same patient are related because they share the same underlying patient-specific random effect.

Random Slopes

A more flexible GLMM can allow patients to have different trajectories over time:

$$ \operatorname{logit}(p_{ij}) = \beta_0 + \beta_1X_i + \beta_2t_j + \beta_3X_it_j + b_{0i} + b_{1i}t_j $$

Here:

  • \(b_{0i}\) is the subject-specific random intercept.
  • \(b_{1i}\) is the subject-specific random time effect.

This allows patients to differ both in their baseline propensity for response and in how their response probability changes over time.

Caution: Random slopes can make a model substantially more complex. They should be supported by the study design, number of repeated observations, sample size, and scientific rationale rather than added automatically.

GEE vs. GLMM

Feature GEE GLMM
Primary interpretation Population-averaged Subject-specific
Correlation handled by Working correlation Random effects
Patient-specific heterogeneity Not explicitly modeled Yes
Random effects No Yes
Typical odds ratio Marginal OR Conditional OR
Missing data considerations Usually requires MAR-type assumptions for standard inference Likelihood-based methods can accommodate MAR under model assumptions
Clinical-trial population interpretation Often straightforward More patient-specific

Why GEE and GLMM Odds Ratios Differ

An important feature of nonlinear models is that marginal and conditional effects are generally not numerically identical.

Suppose a GLMM estimates a conditional odds ratio of 3.0.

A corresponding GEE analysis might estimate a marginal odds ratio of 2.4.

This does not necessarily mean that one model is wrong.

The models are answering different questions.

Key distinction: A subject-specific odds ratio describes the treatment effect conditional on a patient's underlying random effect. A population-averaged odds ratio describes the average treatment effect across the population. For nonlinear models such as logistic regression, these quantities generally differ.

Working Correlation Structures in GEE

GEE requires a working correlation structure.

Common choices include:

Structure Assumption
Independent Repeated measurements treated as uncorrelated for the working covariance
Exchangeable All pairs of observations from the same subject have the same correlation
AR(1) Correlation decreases as visits become farther apart
Unstructured Each pairwise correlation is estimated separately

Exchangeable Correlation

Under exchangeable correlation:

$$ \operatorname{Corr}(Y_{ij},Y_{ik})=\rho \qquad j\ne k $$

Every pair of visits within the same subject has the same correlation.

This can be reasonable when the visits are relatively similar in spacing and there is no strong reason to expect correlation to decline with time.

AR(1) Correlation

An AR(1) structure assumes that observations closer together in time are more strongly correlated.

$$ \operatorname{Corr}(Y_{ij},Y_{ik}) = \rho^{|j-k|} $$

For example, if \(\rho=0.70\):

Visit Separation Correlation
1 visit apart 0.70
2 visits apart 0.49
3 visits apart 0.34

AR(1) is often appealing for regularly spaced longitudinal assessments.

Unstructured Correlation

An unstructured working correlation matrix places no simple restrictions on the pairwise correlations.

For four visits:

$$ R= \begin{pmatrix} 1 & \rho_{12} & \rho_{13} & \rho_{14}\\ \rho_{12} & 1 & \rho_{23} & \rho_{24}\\ \rho_{13} & \rho_{23} & 1 & \rho_{34}\\ \rho_{14} & \rho_{24} & \rho_{34} & 1 \end{pmatrix} $$

This is flexible but requires many correlation parameters.

Practical principle: Do not select an unstructured correlation matrix simply because it is the most flexible. With many visits and limited sample size, estimating numerous correlations can become unstable.

Does the GEE Working Correlation Have to Be Correct?

One of the major attractions of GEE is that inference can remain valid under a misspecified working correlation when an appropriate sandwich, or robust, variance estimator is used, under the usual regularity conditions.

The working correlation therefore does not have exactly the same role as a fully specified likelihood covariance model.

A useful distinction is:

1
The mean model specifies the treatment and time effects of scientific interest.
2
The working correlation describes the assumed association among repeated observations.
3
The robust variance estimator protects inference against certain forms of working-correlation misspecification.

Small-Sample GEE Considerations

The large-sample properties of GEE are important.

With a small number of independent subjects, however, the ordinary sandwich variance estimator can be biased downward or otherwise provide poor finite-sample inference.

This is especially important in clinical trials with relatively few randomized subjects but multiple repeated observations.

Potential approaches include:

  • Finite-sample corrections to the sandwich estimator
  • Small-sample-adjusted Wald tests
  • Alternative inferential procedures when justified
  • Likelihood-based GLMM approaches
Important: Having many repeated visits does not necessarily solve the small-sample GEE problem. The number of independent subjects is often the critical quantity for asymptotic inference.

Choosing GEE or GLMM

The choice should begin with the scientific estimand rather than the software procedure.

Scientific Question Potentially Appropriate Approach
What is the average treatment effect in the target population? GEE / marginal model
How does treatment affect an individual subject conditional on latent patient characteristics? GLMM
Is patient-level heterogeneity itself scientifically important? GLMM
Is the primary estimand population-level? GEE is often attractive
Is subject-specific prediction important? GLMM is often attractive

A Clinical Trial Example

Suppose a randomized clinical trial compares an active treatment with placebo.

The binary endpoint is: clinical response = 1 if the patient meets the prespecified response criterion at the visit; 0 otherwise.

Patients are assessed at Weeks 4, 8, and 12.

The analysis objective is to compare treatment groups over the follow-up period while accounting for repeated measurements.

Example Data Structure

USUBJID Treatment Week Response
001 Active 4 0
001 Active 8 1
001 Active 12 1
002 Active 4 1
002 Active 8 1
002 Active 12 0
003 Placebo 4 0
003 Placebo 8 0
003 Placebo 12 1

The data should generally be represented in long format for GEE and GLMM analyses.

Why Long Format Is Important

In long format, each row corresponds to one subject-visit combination.

For subject \(i\) with three visits, there are three rows.

This allows the statistical software to identify:

  • Which observations belong to the same subject
  • Which visit each observation represents
  • Which treatment the subject received
  • Which observations are missing

Model Specification

A typical model might be:

$$ \operatorname{logit}\{P(Y_{ij}=1)\} = \beta_0 + \beta_1\operatorname{Treatment}_i + \beta_2\operatorname{Visit}_{j} + \beta_3 \left( \operatorname{Treatment}_i\times\operatorname{Visit}_{j} \right) $$

If visit is categorical, the model allows a separate treatment comparison at each post-baseline visit.

Categorical vs. Continuous Time

Time can be represented as a categorical factor or as a continuous variable.

Categorical Visit

If the model includes separate indicators for Weeks 8 and 12 relative to Week 4, it does not assume a linear time trend.

This is often appropriate when clinical response trajectories may be nonlinear.

Continuous Time

A continuous time variable imposes a functional form on the trajectory.

For example:

$$ \operatorname{logit}(p_{ij}) = \beta_0+\beta_1t_j $$

This is parsimonious but assumes a linear relationship on the log-odds scale.

Clinical-trial recommendation: When the number of scheduled visits is modest, treating visit as categorical is often a safer primary specification because it avoids imposing an unnecessary linear trajectory assumption.

Reference Categories Matter

Suppose Week 4 is the reference visit and placebo is the reference treatment.

Then:

  • The treatment coefficient compares active treatment with placebo at Week 4.
  • The Week 8 coefficient describes change from Week 4 within placebo.
  • The treatment-by-Week 8 interaction describes the additional active-versus-placebo difference at Week 8.

The same logic applies at Week 12.

Interpreting an Interaction Model

Suppose the estimated coefficients are:

Parameter Estimate
Treatment 0.40
Week 8 0.55
Week 12 0.80
Treatment × Week 8 0.30
Treatment × Week 12 0.65

The Week 12 treatment effect on the log-odds scale is:

$$ 0.40+0.65=1.05 $$

Therefore the corresponding odds ratio is:

$$ OR_{12}=e^{1.05}\approx2.86 $$

Thus, at Week 12, the estimated odds of response are approximately 2.86 times as high for active treatment as for placebo, under the relevant interpretation of the model.

Do Not Interpret the Interaction Alone as the Treatment Effect

A common mistake is to report the treatment-by-time interaction coefficient as if it were the complete treatment effect at that visit.

With treatment and interaction terms in the model, the treatment effect at a particular visit is determined by the relevant combination of coefficients.

For example:

$$ \text{Treatment effect at Week 12} = \beta_{\text{Treatment}} + \beta_{\text{Treatment}\times\text{Week 12}} $$

This should then be exponentiated when reporting an odds ratio.

From Odds Ratios to Probabilities

Odds ratios can be difficult to interpret clinically.

Therefore, model-based predicted probabilities are often valuable.

For a logistic model:

$$ p = \frac{\exp(\eta)} {1+\exp(\eta)} $$

where \(\eta\) is the linear predictor.

For example, if:

$$ \eta=0.75 $$

then:

$$ p = \frac{e^{0.75}} {1+e^{0.75}} \approx0.679 $$

or approximately 67.9%.

Best practice: For clinical interpretation, consider reporting adjusted response probabilities or risk differences alongside odds ratios whenever the analysis and estimand support such summaries.

Risk Difference, Risk Ratio, and Odds Ratio

Binary longitudinal outcomes can be summarized using several effect measures.

Measure Definition
Risk difference \(p_T-p_C\)
Risk ratio \(p_T/p_C\)
Odds ratio \([p_T/(1-p_T)]/[p_C/(1-p_C)]\)

The logistic link naturally produces odds ratios.

If risk differences or risk ratios are the primary estimand, alternative marginal models and link functions may be more appropriate.

GEE With a Logit Link

A standard GEE specification for a binary outcome uses:

$$ g(p_{ij})=\operatorname{logit}(p_{ij}) $$

which leads to odds-ratio interpretations.

Other links are possible.

Link Common Interpretation
Logit Odds ratio
Log Risk ratio under appropriate model specification
Identity Risk difference

The identity and log links can present numerical or convergence challenges when probabilities approach the boundaries of 0 and 1.

Missing Longitudinal Binary Outcomes

Missing data are especially important in longitudinal clinical trials.

A patient may have:

  • A Week 4 response
  • A missing Week 8 response
  • A Week 12 response

or may discontinue treatment and contribute no later assessments.

The missing-data mechanism therefore becomes part of the analysis strategy.

MCAR, MAR, and MNAR

Mechanism Meaning
MCAR Missing completely at random
MAR Missingness may depend on observed information
MNAR Missingness may depend on unobserved information

The distinction is fundamental because different methods require different assumptions.

GEE and Missing Data

Standard GEE analyses with commonly used estimating procedures generally rely on assumptions concerning the missingness process.

Under appropriate conditions, GEE can provide valid inference under missing-at-random-type mechanisms when the mean model and missingness-related assumptions are appropriately specified.

However, simply stating that "GEE handles missing data" is incorrect.

Important: GEE does not automatically make missing data ignorable. The missingness assumptions and analysis strategy should be explicitly considered in the statistical analysis plan.

GLMM and Missing Data

Likelihood-based GLMM analyses can use all available repeated observations under the model assumptions.

This is one reason GLMMs are frequently considered for longitudinal clinical trial analyses with incomplete follow-up.

Under a MAR framework, likelihood-based estimation can provide valid inference without requiring ad hoc last-observation-carried-forward imputation.

However, the validity still depends on the model and missing-data assumptions.

Why LOCF Is Usually Problematic

Last observation carried forward, or LOCF, replaces a missing future observation with the patient's last observed value.

For longitudinal binary outcomes this can be particularly unrealistic.

A patient who responded at Week 4 but discontinued treatment before Week 12 is not necessarily still a responder at Week 12.

LOCF can therefore introduce bias and distort uncertainty.

Modern principle: Use model-based or multiple-imputation approaches that are appropriate for the estimand and missing-data assumptions rather than automatically carrying the last observation forward.

Intermittent vs. Monotone Missingness

Two important patterns are:

  • Intermittent missingness: a patient misses one visit but returns later.
  • Monotone dropout: once observations stop, all subsequent observations are missing.

Longitudinal likelihood-based methods can often use all available information without requiring a complete data set.

Subject-Level Correlation

Why are repeated binary outcomes correlated?

Consider a patient's latent disease severity.

A patient who is likely to respond at Week 4 may also be more likely to respond at Week 8 and Week 12.

This induces positive within-subject correlation.

The correlation can be represented conceptually as:

$$ \operatorname{Corr}(Y_{i1},Y_{i2})>0 $$

and similarly for other pairs of visits.

Correlation Is Not the Treatment Effect

A common conceptual mistake is to interpret the estimated correlation as a clinical treatment effect.

The correlation describes the dependence among repeated observations within subjects.

The treatment coefficient describes the association between treatment and the binary outcome after accounting for the model structure.

Think of the model as having two jobs: the mean model answers the treatment question, while the correlation or random effects account for the repeated-measures structure.

GEE Implementation in R

The geepack package provides a commonly used implementation of GEE in R.

library(geepack)

fit_gee <- geeglm(
  response ~ treatment * visit,
  id = usubjid,
  data = dat,
  family = binomial(link = "logit"),
  corstr = "exchangeable"
)

summary(fit_gee)

Here:

  • response is the binary endpoint.
  • treatment identifies the randomized treatment.
  • visit represents the repeated assessment.
  • id identifies the patient.
  • corstr specifies the working correlation structure.

GEE With AR(1)

fit_gee_ar1 <- geeglm(
  response ~ treatment * visit,
  id = usubjid,
  data = dat,
  family = binomial(link = "logit"),
  corstr = "ar1"
)

summary(fit_gee_ar1)

An AR(1) structure can be considered when observations close together in time are expected to be more strongly correlated.

Extracting Odds Ratios in R

beta <- coef(fit_gee)

OR <- exp(beta)

OR

Confidence intervals can be obtained from the estimated coefficients and their standard errors.

se <- sqrt(diag(vcov(fit_gee)))

lower <- exp(beta - 1.96 * se)
upper <- exp(beta + 1.96 * se)

results <- data.frame(
  estimate = beta,
  OR = OR,
  lower = lower,
  upper = upper
)

results

GLMM Implementation in R

A logistic GLMM can be fitted using the lme4 package.

library(lme4)

fit_glmm <- glmer(
  response ~ treatment * visit + (1 | usubjid),
  data = dat,
  family = binomial(link = "logit")
)

summary(fit_glmm)

The expression:

(1 | usubjid)

specifies a subject-specific random intercept.

Random-Slope GLMM in R

fit_glmm_slope <- glmer(
  response ~ treatment * visit +
    (1 + visit | usubjid),
  data = dat,
  family = binomial(link = "logit")
)

summary(fit_glmm_slope)

This allows both the intercept and the effect of time to vary across patients.

For categorical visit, random slopes can become parameter-heavy. A random-intercept model is often a more stable starting point.

GEE Implementation in SAS

In SAS, PROC GENMOD can be used for GEE models.

proc genmod data=analysis descending;
    class usubjid treatment visit;

    model response =
        treatment
        visit
        treatment*visit
        / dist=binomial
          link=logit;

    repeated subject=usubjid
        / type=exch
          corrw
          empirical;

run;

The repeated statement identifies the repeated observations within subject.

SAS With AR(1)

proc genmod data=analysis descending;
    class usubjid treatment visit;

    model response =
        treatment
        visit
        treatment*visit
        / dist=binomial
          link=logit;

    repeated subject=usubjid
        / type=ar(1)
          empirical;

run;

The empirical option requests the robust sandwich covariance estimator.

GLMM Implementation in SAS

A logistic GLMM can be fitted using PROC GLIMMIX.

proc glimmix data=analysis;
    class usubjid treatment visit;

    model response(event='1') =
        treatment
        visit
        treatment*visit
        / dist=binomial
          link=logit
          solution
          oddsratio;

    random intercept / subject=usubjid;

run;

The random intercept accounts for subject-level heterogeneity.

Random Slopes in SAS

proc glimmix data=analysis;
    class usubjid treatment visit;

    model response(event='1') =
        treatment
        visit
        treatment*visit
        / dist=binomial
          link=logit
          solution
          oddsratio;

    random intercept visit
        / subject=usubjid
          type=un;

run;

The unstructured random-effects covariance allows the random intercept and random time effect to be correlated.

Comparing Working Correlation Structures

When fitting GEE models, investigators may compare plausible working correlation structures.

Candidate When It May Be Reasonable
Independent Within-subject correlation is weak or used as a robustness specification
Exchangeable Repeated visits have broadly similar correlations
AR(1) Correlation is expected to decline with time separation
Unstructured Few visits and sufficient sample size to estimate correlations reliably

Correlation selection should be based on the study design, clinical timing, scientific knowledge, and model diagnostics rather than simply selecting the structure that produces the most favorable treatment p-value.

QIC and GEE Model Comparison

The quasi-likelihood under the independence model criterion, commonly called QIC, can be used when comparing GEE specifications.

Conceptually, QIC plays a role analogous to information criteria used in likelihood-based modeling, although the interpretation is not identical.

A smaller QIC can support a preferred working correlation structure among candidate models, but clinical and statistical considerations should also be taken into account.

Do not optimize correlation structure using treatment significance. The working correlation should describe the repeated-measures structure, not be selected because it produces the smallest treatment p-value.

What Happens If the Correlation Is Ignored?

Suppose four repeated observations per subject are treated as independent.

The analysis may behave as though there are four times as much independent information as actually exists.

This can lead to standard errors that are too small and confidence intervals that are too narrow.

Consequently, statistical significance can be overstated.

Core principle: Repeated observations increase information, but they do not provide the same amount of information as the same number of independent subjects.

Binary Outcomes Are Different From Continuous Outcomes

For continuous longitudinal outcomes, linear mixed models are often natural.

For binary outcomes, the response distribution is Bernoulli or binomial and the relationship between covariates and the mean is nonlinear.

Therefore, a standard linear mixed model is generally inappropriate for a binary endpoint.

Outcome Common Longitudinal Model
Continuous Linear mixed model / MMRM
Binary GEE / logistic GLMM
Count Poisson or negative-binomial GEE / GLMM
Ordinal Ordinal GEE / cumulative-link mixed model

Binary Response vs. Repeated Binary Event

The meaning of the binary endpoint must be defined carefully.

"Response at Week 12" is different from "ever experienced an adverse event."

A longitudinal binary response can represent a patient's status at each visit.

An adverse-event indicator may instead represent whether an event has occurred by a particular time.

The analysis should therefore match the clinical definition of the endpoint.

Monotone Response Processes Require Care

Some binary outcomes are inherently persistent.

For example, once a patient experiences a particular event, the status may remain 1 at all subsequent visits.

In such situations, the repeated observations may have a very different dependence structure from a repeatedly assessed reversible response.

Before choosing a model: Ask whether the binary outcome can naturally switch between 0 and 1 over time. The clinical behavior of the endpoint should influence the modeling strategy.

Responder Analysis at a Single Visit

A study may specify Week 12 response as the primary endpoint.

In that case, a primary analysis could compare treatment groups at Week 12 using an appropriate binary-outcome model.

Earlier response measurements may then serve as supportive longitudinal information rather than being incorporated into the primary estimand.

This can be appropriate when the clinical question is specifically: What is the treatment effect on response at Week 12?

Longitudinal Estimand vs. Single-Visit Estimand

Question Example Estimand
Single time point Treatment effect on response at Week 12
Repeated trajectory Treatment effect across Weeks 4, 8, and 12
Average effect Population-average treatment effect over follow-up
Subject-specific effect Treatment effect conditional on patient-specific random effects

The model should follow the estimand.

A Worked Numerical Example

Suppose a trial has 200 patients, 100 randomized to active treatment and 100 to placebo.

The observed response rates are:

Visit Active Placebo
Week 4 35% 25%
Week 8 52% 34%
Week 12 64% 42%

The response rate difference appears to increase over time.

This suggests that a treatment-by-time interaction may be clinically relevant.

Approximate Week 12 Odds Ratio

At Week 12:

$$ p_T=0.64 \qquad p_C=0.42 $$

The active-treatment odds are:

$$ \frac{0.64}{1-0.64} = \frac{0.64}{0.36} \approx1.778 $$

The placebo odds are:

$$ \frac{0.42}{1-0.42} = \frac{0.42}{0.58} \approx0.724 $$

Therefore the crude Week 12 odds ratio is approximately:

$$ OR = \frac{1.778}{0.724} \approx2.46 $$

A longitudinal model can provide an adjusted estimate while accounting for the repeated observations.

Why the Crude and Model-Based OR May Differ

The model may adjust for:

  • Baseline covariates
  • Other visits
  • Treatment-by-time interactions
  • Within-subject correlation
  • Model-specific random effects

Therefore, the longitudinal model's estimate should not be expected to equal the crude cross-sectional odds ratio.

Predicted Probabilities Are Often More Intuitive

Suppose the fitted model estimates:

Visit Adjusted Active Probability Adjusted Placebo Probability
Week 4 34% 26%
Week 8 51% 35%
Week 12 63% 43%

The corresponding Week 12 risk difference is:

$$ 0.63-0.43=0.20 $$

or 20 percentage points.

This may be more clinically intuitive than an odds ratio alone.

Confidence Intervals

For a logistic coefficient \(\hat{\beta}\) with standard error \(SE(\hat{\beta})\), a Wald confidence interval on the log-odds scale is:

$$ \hat{\beta} \pm z_{1-\alpha/2}SE(\hat{\beta}) $$

Exponentiating gives the corresponding odds-ratio confidence interval:

$$ \left[ e^{L}, e^{U} \right] $$

where \(L\) and \(U\) are the lower and upper limits on the log-odds scale.

Testing the Treatment-by-Time Interaction

Suppose there are three visits and two treatment-by-time interaction parameters.

The joint hypothesis might be:

$$ H_0: \beta_{\text{Treatment}\times\text{Week 8}} = \beta_{\text{Treatment}\times\text{Week 12}} = 0 $$

A joint test evaluates whether the treatment effect is consistent across visits.

If the interaction is not important, a simpler model may estimate an overall treatment effect across the repeated assessments, depending on the prespecified estimand.

Don't Automatically Remove the Interaction

A nonsignificant interaction does not automatically prove that treatment effects are identical at every time point.

The decision should consider:

  • Clinical plausibility
  • Effect estimates and confidence intervals
  • Study design
  • Prespecified estimand
  • Power for detecting interaction

Interaction tests can have substantially less power than the main treatment comparison.

Baseline Binary Measurements

Some longitudinal studies also measure the binary outcome at baseline.

Whether baseline is included in the repeated outcome model depends on the estimand, study design, and analysis strategy.

In randomized trials, baseline adjustment can improve precision when handled appropriately.

However, baseline response status may require special treatment if it is structurally different from post-baseline response.

Do not mechanically treat baseline as just another follow-up visit. Determine whether the baseline measurement represents the same estimand-relevant outcome process as the post-baseline assessments.

Covariate Adjustment

A longitudinal binary model can include baseline covariates such as:

  • Age
  • Sex
  • Baseline disease severity
  • Prior treatment
  • Geographic region
  • Stratification factors

A general model is:

$$ \operatorname{logit}(p_{ij}) = \beta_0 + \beta_1X_i + \boldsymbol{\gamma}^{T}\mathbf{Z}_i + \beta_2t_j + \beta_3X_it_j $$

where \(\mathbf{Z}_i\) contains baseline covariates.

Clinical Trial Stratification Factors

If randomization was stratified by a factor such as disease severity or region, the primary analysis should generally respect the prespecified randomization and analysis strategy.

Ignoring important stratification factors can reduce efficiency or produce an analysis inconsistent with the trial's planned inferential framework.

Multiplicity Across Visits

Longitudinal analyses can generate several treatment comparisons:

  • Active vs. placebo at Week 4
  • Active vs. placebo at Week 8
  • Active vs. placebo at Week 12

If all three are used to support a confirmatory claim, multiplicity may need to be addressed.

A longitudinal model does not automatically eliminate multiplicity.

Important: The presence of a single fitted longitudinal model does not mean that multiple post-baseline treatment comparisons are automatically multiplicity-free.

Model-Based Least-Squares Means

In clinical reporting, investigators may want adjusted probabilities by treatment and visit.

These can be obtained from model-based marginal means or estimated marginal means.

The resulting table might look like:

Visit Active Placebo Risk Difference
Week 4 34% 26% 8%
Week 8 51% 35% 16%
Week 12 63% 43% 20%

Such summaries can make a technically complex longitudinal model much easier for clinicians to interpret.

Model Diagnostics

Binary longitudinal models require different diagnostics from ordinary linear regression.

Useful checks include:

  • Convergence
  • Boundary estimates
  • Estimated correlation parameters
  • Random-effect variance estimates
  • Influential subjects
  • Predicted probabilities
  • Observed versus predicted response patterns
  • Sensitivity to covariance structure

Convergence Problems in GLMMs

GLMMs can encounter convergence problems, especially with:

  • Small sample sizes
  • Sparse binary outcomes
  • Rare events
  • Many random-effect parameters
  • Strong separation
  • Highly correlated random effects

A convergence warning should not simply be ignored.

Good practice: Investigate whether the model is overparameterized, whether the data support the random-effects structure, and whether alternative scientifically justified specifications produce stable results.

Complete Separation

Logistic models can experience separation when a predictor perfectly predicts the binary outcome.

For example, if every patient receiving a treatment responds and nobody in placebo responds at a particular visit, the corresponding logistic coefficient may become extremely large.

This can cause estimation difficulties in both ordinary logistic regression and more complicated longitudinal models.

Rare Binary Outcomes

If the outcome is rare, standard asymptotic methods can become less reliable, particularly when the number of subjects is small.

Investigators should consider:

  • Event frequency
  • Number of independent subjects
  • Model complexity
  • Separation
  • Finite-sample inference

Rare outcomes may require specialized methods depending on the study objective.

GEE and GLMM Sensitivity Analysis

For an important clinical-trial analysis, it can be useful to examine whether the treatment conclusion is robust across reasonable modeling approaches.

For example:

Analysis Purpose
Primary GEE Population-averaged treatment effect
Alternative GEE correlation Assess sensitivity to working correlation
Logistic GLMM Assess subject-specific interpretation
Multiple imputation Assess missing-data sensitivity
Pattern-mixture / MNAR sensitivity analysis Assess departures from MAR assumptions

What Should the Primary Analysis Be?

There is no universal answer.

If the estimand is explicitly population-averaged, GEE may be a natural primary framework.

If patient-specific heterogeneity is scientifically important, a GLMM may be more appropriate.

The choice should be specified before unblinding treatment-group outcome data.

Common Mistakes

  1. Using ordinary logistic regression on stacked repeated observations. This ignores the within-subject dependence unless an appropriate variance strategy is used.
  2. Assuming GEE and GLMM estimate the same odds ratio. Marginal and conditional effects generally differ for nonlinear models.
  3. Choosing a covariance structure based on the treatment p-value. Correlation structure should be justified independently of treatment significance.
  4. Ignoring missing-data assumptions. Neither GEE nor GLMM makes missing data automatically harmless.
  5. Reporting only odds ratios. Adjusted response probabilities and risk differences can often be more clinically interpretable.
  6. Ignoring treatment-by-time interaction. A treatment effect can change substantially over follow-up.
  7. Overfitting random effects. Random slopes and complex covariance structures require sufficient information.
  8. Including baseline mechanically. Baseline should be handled according to the estimand and prespecified analysis.
  9. Ignoring multiplicity. Multiple visit-specific treatment comparisons may create multiplicity concerns.
  10. Ignoring convergence warnings. A model that has not converged should not automatically be treated as valid.

A Practical Analysis Workflow

1
Define the binary endpoint and its clinical meaning.
2
Define the longitudinal estimand and treatment comparison.
3
Reshape the data into subject-visit long format.
4
Define the visit representation: categorical, continuous, or another prespecified form.
5
Determine whether treatment-by-time interaction is required.
6
Choose a marginal GEE or subject-specific GLMM framework according to the estimand.
7
Specify a clinically and statistically defensible correlation or random-effects structure.
8
Specify the missing-data strategy.
9
Fit the prespecified primary model.
10
Check convergence, model diagnostics, and sensitivity to reasonable specifications.
11
Report treatment effects with confidence intervals and clinically interpretable summaries.
12
Document the analysis clearly in the Statistical Analysis Plan and clinical study report.

What Should Be Reported in the Statistical Analysis Plan?

A longitudinal binary analysis should be sufficiently prespecified that another statistician could reproduce the primary analysis.

The SAP should generally describe:

  • Primary binary endpoint
  • Assessment visits
  • Analysis population
  • Estimand
  • Treatment effect measure
  • Link function
  • Mean model
  • Visit parameterization
  • Treatment-by-time interaction
  • Correlation structure for GEE or random-effects structure for GLMM
  • Variance estimator
  • Covariate adjustment
  • Missing-data assumptions
  • Multiplicity strategy
  • Confidence interval methodology
  • Sensitivity analyses

Example SAP Language

A population-averaged analysis might be described conceptually as:

Example: The primary binary response endpoint will be analyzed using a generalized estimating equation with a logit link. The model will include treatment, visit, and treatment-by-visit interaction. Repeated observations within subject will be accounted for using a prespecified working correlation structure and robust variance estimation. Adjusted response probabilities and treatment contrasts will be estimated at each prespecified visit.

A GLMM-based analysis would instead explicitly specify the random-effects structure.

Interpreting a GEE Result

Suppose the primary GEE analysis estimates:

$$ \widehat{\beta}_{Treatment}=0.693 $$

Then:

$$ OR=e^{0.693}\approx2.00 $$

A population-averaged interpretation is: the estimated odds of response are approximately twice as high in the active-treatment group as in the placebo group, under the specified marginal model.

The exact interpretation depends on the reference visit and whether a treatment-by-time interaction is included.

Interpreting a GLMM Result

Suppose a logistic GLMM estimates:

$$ \widehat{\beta}_{Treatment}=1.099 $$

Then:

$$ OR=e^{1.099}\approx3.00 $$

This represents a subject-specific odds ratio under the conditional model.

It should not automatically be described as a population-average odds ratio.

GEE Robustness to Correlation Misspecification

Suppose the true correlation is AR(1), but an exchangeable working correlation is used.

With appropriate robust variance estimation, the GEE regression coefficient can remain consistently estimated under standard conditions even if the working correlation is not exactly correct.

However, the efficiency of estimation can change.

Therefore, choosing a reasonable working correlation remains useful even though the robust variance provides protection against certain forms of misspecification.

When Independence GEE Can Be Useful

An independence working correlation may seem strange for longitudinal data.

It can nevertheless be useful as a sensitivity analysis or when the primary scientific inference is robust to the correlation specification.

With robust variance estimation, the mean-model coefficient can remain valid under appropriate conditions even when the working independence structure does not reflect the actual within-subject correlation.

Marginal vs. Conditional: A Conceptual Example

Imagine that patients vary substantially in their baseline propensity to respond.

A patient-specific treatment effect may be large after conditioning on their latent propensity.

When averaging over heterogeneous patients, the population-level effect can be attenuated.

This is one reason a conditional GLMM odds ratio can be farther from 1 than a marginal GEE odds ratio.

Do not ask which odds ratio is "the real one." The correct effect measure depends on the scientific question and estimand.

Model-Based Predictions

For a fitted logistic model, predictions can be generated for each treatment and visit combination.

newdat <- expand.grid(
  treatment = c("Placebo", "Active"),
  visit = c("Week 4", "Week 8", "Week 12")
)

newdat$predicted <- predict(
  fit_gee,
  newdata = newdat,
  type = "response"
)

newdat

For GLMMs, predictions require attention to whether the desired predictions are conditional on random effects or marginal over the random-effects distribution.

Conditional vs. Population-Level Predictions

This distinction is especially important with GLMMs.

A prediction conditional on a subject-specific random effect answers a different question from a prediction averaged over the population distribution of random effects.

When reporting clinical treatment probabilities, the desired prediction scale should be specified explicitly.

Model Validation and Sensitivity

A strong longitudinal analysis should not end with the primary model fit.

Useful sensitivity analyses may include:

  • Alternative GEE working correlations
  • GEE versus GLMM
  • Alternative visit parameterizations
  • Alternative missing-data assumptions
  • Adjusted versus unadjusted models
  • Alternative treatment-by-time specifications

The purpose is not to search for the most favorable result.

The purpose is to determine whether the scientific conclusion is robust to reasonable analytical assumptions.

A Compact Decision Tree

A
Is the endpoint binary and repeatedly measured within subject?
Yes → consider a longitudinal binary model.
B
Is the target estimand population-averaged?
Consider → GEE.
C
Is patient-specific heterogeneity central?
Consider → GLMM.
D
Does treatment effect plausibly change over time?
Consider → treatment-by-visit interaction.
E
Are observations missing?
Yes → explicitly address the missing-data assumptions.

Key Differences Between GEE and GLMM

Question GEE GLMM
What is modeled? Population mean Conditional subject-specific mean
Correlation mechanism Working correlation Random effects
Typical effect Marginal OR Conditional OR
Subject-specific inference Limited Natural
Robust variance Central feature Not the defining feature
Likelihood Quasi-likelihood / estimating equations Likelihood-based
Prediction of subject heterogeneity Not the primary goal Major strength

What About Generalized Estimating Equations With Exchangeable Correlation?

A very common clinical-trial specification is:

$$ \operatorname{logit}(p_{ij}) = \beta_0 + \beta_1Treatment_i + \beta_2Visit_j + \beta_3Treatment_iVisit_j $$

with an exchangeable working correlation.

This can be a useful and interpretable population-averaged model when the scientific objective concerns average treatment response over scheduled visits.

What About GLMM With a Random Intercept?

A common GLMM is:

$$ \operatorname{logit}(p_{ij}) = \beta_0 + \beta_1Treatment_i + \beta_2Visit_j + \beta_3Treatment_iVisit_j + b_i $$

This is often a reasonable starting model because it captures persistent subject-level differences without requiring a large number of random-effects parameters.

Which Is Better?

Neither method is universally better.

The question should instead be: Which model corresponds to the scientific estimand and assumptions of the study?

A GEE can be preferable for a population-level treatment question.

A GLMM can be preferable when subject-level heterogeneity is central.

In some studies, both can be useful as complementary analyses.

What to Put in a Clinical Study Report

A clinical study report should clearly identify:

  • The binary endpoint
  • All scheduled assessment visits
  • The primary analysis population
  • The estimand
  • The longitudinal model
  • The link function
  • The treatment and visit terms
  • The interaction specification
  • The working correlation or random-effects structure
  • The variance estimator
  • The missing-data assumptions
  • The estimated treatment effects
  • Confidence intervals
  • Adjusted response probabilities where useful
  • Sensitivity analyses

Example Results Table

Visit Active Response Placebo Response Adjusted OR 95% CI
Week 4 34% 26% 1.47 1.02–2.13
Week 8 51% 35% 1.92 1.31–2.81
Week 12 63% 43% 2.26 1.52–3.37

A table like this is generally more useful to clinical readers than reporting only a single regression coefficient.

Important Distinction: Repeated Binary Outcomes vs. Binary Repeated Events

A repeated binary status and a recurrent-event process are not interchangeable.

For example:

  • "Patient is in remission at Week 12" is a binary longitudinal status.
  • "Patient experienced three disease flares during follow-up" is a recurrent event count.
  • "Time until first flare" is a time-to-event endpoint.

Each requires a different statistical framework.

When a Survival Model May Be Better

If the clinical question is primarily: How long until the patient first achieves response? then a survival-analysis framework may be more appropriate than repeated binary logistic modeling.

Similarly, if the question is: How long until loss of response? a time-to-event model may better represent the endpoint.

Model the scientific question, not merely the data format. The fact that an outcome is recorded as 0/1 at multiple visits does not automatically mean that GEE or GLMM is the best possible analysis.

Longitudinal Binary Analysis Checklist

Question Check
Is the endpoint truly binary? Yes / No
Are observations repeated within subject? Yes / No
What is the estimand? Population / subject-specific / other
Is visit categorical? Prespecify
Is treatment-by-time interaction required? Prespecify
GEE or GLMM? Based on estimand
Correlation structure? Prespecify
Missing-data assumptions? Prespecify
Multiplicity? Assess
Clinical interpretation? Include probabilities and/or risk differences where appropriate

The Most Important Concept

The central issue in longitudinal binary analysis is not simply that the outcome is binary.

It is the combination of:

  • A binary response distribution
  • Repeated observations within the same patient
  • Potentially changing treatment effects over time
  • Within-subject correlation
  • Incomplete follow-up
  • A specific scientific estimand

GEE and GLMM solve the correlation problem in different ways.

GEE focuses on the population-average mean response and uses a working correlation plus robust inference.

GLMMs introduce subject-specific random effects and provide conditional interpretations.

Bottom line: For longitudinal binary outcomes, ordinary logistic regression is generally not sufficient because repeated observations from the same subject are correlated. GEE provides a population-averaged framework that accounts for within-subject dependence through a working correlation and robust variance estimation. Logistic GLMMs provide a subject-specific framework by modeling patient-level random effects. The correct choice depends primarily on the scientific estimand, not on which method produces the smaller p-value. Time, treatment-by-time interaction, correlation structure, missing-data assumptions, and clinical interpretation should all be specified before the primary analysis is performed.

References

Liang, K.-Y. & Zeger, S.L. (1986). Longitudinal data analysis using generalized linear models. Biometrika, 73(1), 13–22.
Zeger, S.L., Liang, K.-Y. & Albert, P.S. (1988). Models for longitudinal data: a generalized estimating equation approach. Biometrics, 44(4), 1049–1060.
Diggle, P., Heagerty, P., Liang, K.-Y. & Zeger, S. (2002). Analysis of Longitudinal Data. 2nd ed. Oxford University Press.
Fitzmaurice, G.M., Laird, N.M. & Ware, J.H. (2011). Applied Longitudinal Analysis. 2nd ed. Wiley.
Hedeker, D. & Gibbons, R.D. (2006). Longitudinal Data Analysis. Wiley.
McCulloch, C.E., Searle, S.R. & Neuhaus, J.M. (2008). Generalized, Linear, and Mixed Models. 2nd ed. Wiley.
Hardin, J.W. & Hilbe, J.M. (2013). Generalized Estimating Equations. 2nd ed. Chapman & Hall/CRC.
Fitzmaurice, G., Davidian, M., Verbeke, G. & Molenberghs, G., eds. (2008). Longitudinal Data Analysis. Chapman & Hall/CRC.