Why Use a Logistic Mixed Model?
A biomarker may be recorded repeatedly as a binary outcome: for example, whether a laboratory value is above a clinically chosen threshold at each visit. The observed values are zero or one, and measurements from the same person are generally related. A logistic mixed model addresses both features: it models the probability of a positive measurement and represents subject-to-subject variation through random effects.
The interpretation is conditional on a subject’s random effects. This matters: a coefficient describes a change in log odds for subjects with the same random effects, not automatically a population-average change in odds. The earlier material on exponential-family longitudinal submodels provides the broader context for choosing a response distribution and link; here the focus is the repeated binary case.
Model Structure and Assumptions
The inverse-logit transformation converts the linear predictor to a probability:
The model is built on several assumptions. Conditional on \(b_i\) and the included covariates, each response is Bernoulli with the stated probability, and repeated responses within a subject are conditionally independent. Random effects are independent across subjects and follow the specified mean-zero multivariate normal distribution. The fixed-effects and random-effects design terms must represent the systematic structure adequately. These assumptions are substantive choices, not consequences of using a logistic link.
Conditional independence does not mean that the observed repeated outcomes are independent without qualification. Integrating over a shared random effect induces association between responses from the same subject. For example, a subject with a high random intercept tends to have higher probabilities of a positive biomarker at multiple visits.
A common starting model has a random intercept:
Here \(t_{ij}\) is time and \(x_i\) is a subject-level covariate. The intercept \(b_{0i}\) shifts that subject’s log odds at every visit. A random time slope can allow subjects’ time trends to differ:
The off-diagonal entry of \(D\) allows a subject’s intercept deviation and slope deviation to be associated. A random slope is not required merely because the outcome is repeated; it should be supported by the design and data, and it can be difficult to estimate when visits are sparse.
Fixed Effects on the Conditional Log-Odds Scale
Suppose a fixed covariate \(x\) enters the linear predictor with coefficient \(\beta_x\), without an interaction. Holding the other covariates and the random effects fixed, increasing \(x\) by one unit changes the linear predictor by \(\beta_x\). Since the linear predictor is the log odds, the conditional odds are multiplied by \(\exp(\beta_x)\). For a change of \(c\) units, the multiplier is \(\exp(c\beta_x)\).
Worked Example: Time, Treatment, and a Conditional Probability
Consider the model $$ \operatorname{logit}(\pi_{ij}) =-2+0.4t_{ij}+0.3z_i-0.1t_{ij}z_i+b_{0i}, $$ where time \(t_{ij}\) is measured in years and \(z_i=1\) denotes the treatment group while \(z_i=0\) denotes the reference group. For the calculation, take a subject with \(b_{0i}=0\) at year \(t_{ij}=2\) in the treatment group.
The conditional linear predictor is $$ \eta=-2+(0.4)(2)+(0.3)(1)+(-0.1)(2)(1)=-1.1. $$ Thus the conditional odds of a positive biomarker measurement are $$ \exp(-1.1)=0.3329, $$ and the conditional probability is $$ \pi_{ij}=\frac{0.3329}{1+0.3329}\approx 0.2497. $$
At the same time, the reference-group subject with \(b_{0i}=0\) has \(\eta=-2+(0.4)(2)=-1.2\), giving odds \(\exp(-1.2)=0.3012\). The treatment-versus-reference conditional odds ratio at year 2 is therefore \(\exp(0.3-0.1(2))=\exp(0.1)=1.105\), matching the ratio \(0.3329/0.3012\approx 1.1052\) up to rounding. The treatment coefficient alone is not the treatment effect at every time because the model includes a time-by-treatment interaction.
What the Random Effects Mean
Random effects describe subject-specific departures from the fixed-effects pattern. In the random-intercept model, \(b_{0i}\) is a subject’s deviation in log odds from the fixed-effects predictor. A one-unit increase in \(b_{0i}\), holding the fixed predictor constant, multiplies that subject’s odds by \(e\). This does not mean the subject’s probability increases by a constant amount: the probability scale is nonlinear.
Worked Example: Interpreting a Subject’s Random Intercept
At a particular visit, suppose a subject’s fixed-effects linear predictor is \(-1.1\). A subject with random intercept \(b_{0i}=0.5\) has conditional linear predictor \(-1.1+0.5=-0.6\). Their conditional odds are \(\exp(-0.6)=0.5488\), and their conditional probability is \(0.5488/(1+0.5488)=0.3543\).
For \(b_{0i}=0\), the odds are \(\exp(-1.1)=0.3329\), and the probability is \(0.2497\). The odds ratio comparing the \(b_{0i}=0.5\) subject with the \(b_{0i}=0\) subject, at the same fixed-effects covariates, is $$ \frac{\exp(-0.6)}{\exp(-1.1)}=\exp(0.5)=1.649. $$ The probabilities differ by about \(0.1046\), not by a factor of \(1.649\). The random intercept is measured on the log-odds scale, not the probability scale.
With a random slope, the subject-specific time slope is a sum of a fixed slope and a random deviation. It describes how that subject’s conditional log odds change with time, given the model; it does not assert that every individual follows a perfectly linear biological trajectory.
Worked Example: A Subject-Specific Time Slope
Suppose $$ \operatorname{logit}(\pi_{ij})=-1+0.25t_{ij}+b_{0i}+b_{1i}t_{ij}. $$ For a subject with \(b_{0i}=0.2\) and \(b_{1i}=-0.15\), the subject-specific intercept is \(-1+0.2=-0.8\), and the subject-specific time slope is \(0.25-0.15=0.10\) log-odds units per year.
At year 0, \(\eta=-0.8\), so the conditional probability is \(\exp(-0.8)/(1+\exp(-0.8))=0.3100\). At year 2, \(\eta=-1+(0.25)(2)+0.2+(-0.15)(2)=-0.6\), so the conditional probability is \(\exp(-0.6)/(1+\exp(-0.6))=0.3543\). Across those two years, the conditional odds ratio is \(\exp(2(0.10))=\exp(0.2)=1.221\). These calculations are conditional on the stated random effects and other model terms.
Likelihood and a Short Justification
The subject-level likelihood contribution is obtained by multiplying the Bernoulli probabilities conditional on the random effects and then integrating over their distribution. This integration is what accounts for the unobserved subject-specific effects:
Here \(\phi_q\) is the \(q\)-dimensional normal density and \(\pi_{ij}(b_i)\) is the inverse-logit probability for a given \(b_i\). In general, the integral does not simplify to a logistic likelihood with the same fixed coefficients. This follows because the inverse-logit is nonlinear: averaging probabilities over random effects is not equivalent to applying the inverse-logit to the average linear predictor. Thus \(\boldsymbol{\beta}\) gives conditional, subject-specific effects; a population-average probability or odds ratio requires averaging predictions over the random-effects distribution and then forming the desired contrast.
State that each \(Y_{ij}\mid b_i\) is Bernoulli and identify the conditional probability and logit link.
Define time, covariates, interactions, and the random-effects design; give the distribution and covariance structure for \(b_i\).
Translate a fixed log-odds contrast into a conditional odds ratio, specifying the covariates and time at which it applies.
Diagnostics, Alternatives, and Limitations
Model checking should examine both the binary response pattern and the repeated-subject structure. Compare observed and model-predicted positive proportions across time and important covariate groups; examine whether the model misses systematic time trends or treatment-by-time differences. Check for sparse combinations, extreme fitted probabilities, convergence warnings, and estimated random-effect variances near zero. Such findings may indicate weak information for the chosen random-effects structure or a mismatch between the model and the data. Because random effects are latent, their estimated distribution should not be treated as a direct set of measured subject traits.
A logistic mixed model is not the only way to analyze repeated binary outcomes. A marginal logistic approach, such as generalized estimating equations, targets population-average associations and uses a working within-subject correlation structure. The mixed model instead specifies subject-specific conditional effects through random effects. An ordinary logistic regression that treats every visit as independent ignores within-subject dependence and can produce misleading uncertainty estimates. Which approach is appropriate depends partly on whether the scientific target is conditional or population-average.
Important limitations include sensitivity to the assumed random-effects distribution and the difficulty of estimating complex random-effects covariance structures with few subjects or visits. Conditional odds ratios are also not generally interchangeable with population-average odds ratios. Finally, a well-fitting model describes conditional associations under its assumptions; by itself, it does not establish that a covariate causes changes in biomarker status.
Common Mistake
Check Your Understanding
Answer each question, then compare with the solutions below.
- A fixed coefficient for a continuous biomarker covariate is \(0.4\), with no interaction. What is the conditional odds ratio for a one-unit increase?
- For a subject, the fixed-effects predictor is \(-1.0\) and the random intercept is \(0.2\). Calculate the conditional predictor and probability.
- Why does setting \(b_i=0\) not generally give the population-average probability?
- What does conditional independence mean in a logistic mixed model, and how can repeated outcomes still be associated marginally?
Solutions. (1) The one-unit conditional odds ratio is \(\exp(0.4)=1.492\), with other terms and random effects held fixed. (2) The conditional predictor is \(-1.0+0.2=-0.8\); the probability is \(\exp(-0.8)/(1+\exp(-0.8))=0.3100\). (3) The population-average probability integrates the inverse-logit probability over the random-effects distribution; because inverse-logit is nonlinear, this average is generally not the inverse-logit at \(b_i=0\). (4) Given the random effects and covariates, the responses are independent Bernoulli variables. Without conditioning, responses share the same random effects, which induces within-subject association.