Why Use a Logistic Mixed-Effects Model?
A binary outcome records whether an event occurred, often coded as 1 for “yes” and 0 for “no.” In pharmacometrics, the event might be a response at a visit, an adverse event, or whether a measurement exceeds a clinical threshold. When outcomes are recorded repeatedly for each subject, observations from the same subject may be related. A logistic mixed-effects model represents that dependence while relating event probability to predictors.
This tutorial focuses on a Bernoulli response and a logit link, with subject-level predictors and a subject-specific random intercept. The model gives fixed coefficients a precise conditional interpretation: they describe changes in odds for subjects with the same random-effect value and the same other covariates. A probability averaged over subjects is a different quantity because it averages over the distribution of random effects.
Model Meaning and Assumptions
The Bernoulli distribution means that, conditional on the predictors and random effect, each outcome is either 0 or 1 with event probability \(p_{ij}\). The logit link maps probabilities between 0 and 1 to the real line, allowing the linear predictor to take any real value. Solving the model equation for the probability gives
In the subject-level-predictor case, a predictor such as baseline severity or treatment assignment is constant across the observations for one subject. It enters the linear predictor in the same way as any other covariate; its coefficient compares subjects differing in that predictor while holding the other covariates and random effect fixed. The random intercept allows subjects with the same recorded covariates to have different underlying event propensities.
The standard interpretation relies on several assumptions. Outcomes are Bernoulli conditional on the predictors and random effect; repeated outcomes are conditionally independent given those quantities; and the random intercepts are independent across subjects and follow the specified normal distribution with mean zero and variance \(\omega^2\). The logit-linear form must be an adequate description of how the included predictors relate to conditional log odds. In typical applications, the random effects are also assumed independent of the observed predictors. Subject-level predictors must be recorded consistently for each subject, and the coding and units of every predictor must be clear.
Under these assumptions, a subject’s repeated outcomes are connected through \(b_i\). Conditional independence does not mean that the outcomes are marginally independent: integrating out the shared random intercept induces dependence between observations from the same subject. The likelihood contribution for subject \(i\) is therefore obtained by multiplying that subject’s Bernoulli probabilities conditional on \(b_i\), then integrating over the random-effect distribution.
Here \(\phi(b;0,\omega^2)\) is the normal density for the random intercept. The integral explains why fitting the model generally requires numerical methods; it is not usually equivalent to fitting an ordinary logistic regression to all observations as if they were independent.
Interpreting Coefficients and Odds Ratios
For a predictor \(x\) with coefficient \(\beta_x\), increasing \(x\) by one unit changes the conditional log odds by \(\beta_x\), provided the other predictors and \(b_i\) are held fixed. Since odds are \(\exp(\eta_{ij})\), exponentiating the coefficient gives a conditional odds ratio. For a change of \(\Delta\) units, that ratio is \(\exp(\beta_x\Delta)\). For a binary predictor coded 0 and 1, \(\exp(\beta_x)\) compares the conditional odds for the group coded 1 with those for the group coded 0.
An odds ratio is not a probability ratio, and a fixed coefficient does not imply a constant change in probability. The probability change depends on the starting linear predictor, including the other covariates and random effect. The random intercept itself shifts conditional log odds by \(b_i\), or multiplies conditional odds by \(\exp(b_i)\); it is not an observed predictor effect.
Worked Example: A Conditional Treatment Odds Ratio
Suppose a hypothetical model has intercept \(\beta_0=-1.2\) and a binary treatment coefficient \(\beta_{\text{trt}}=0.7\), with no other predictors. First consider a subject with \(b_i=0\). Calculate the control and treatment probabilities and interpret the treatment coefficient.
For control, the linear predictor is \(\eta=-1.2\). The event probability is \(p=1/(1+\exp(1.2))\approx0.2315\). The corresponding odds are \(p/(1-p)\approx0.3012\); equivalently, \(\exp(-1.2)\approx0.3012\).
For treatment, \(\eta=-1.2+0.7=-0.5\), so \(p=1/(1+\exp(0.5))\approx0.3775\). The treatment odds are \(\exp(-0.5)\approx0.6065\).
The conditional odds ratio is \(\exp(0.7)\approx2.014\). Thus, at the same random-effect value and covariate values, the model gives about 2.014 times the event odds for treatment compared with control. In this example, the conditional probability difference is about \(0.3775-0.2315=0.1460\), or 14.60 percentage points. That probability difference is specific to these baseline conditions; it is not the coefficient’s general interpretation.
Calculating Subject-Conditional Probabilities
A subject-conditional prediction specifies the random-effect value as well as the covariates. If a subject’s random effect is estimated from their repeated data, a prediction using that estimate is often called an individual or subject-specific prediction. For a new subject, the random effect is not observed; setting it to zero gives a prediction for a subject at the mean of the random-effect distribution, not the average probability across the population.
Worked Example: Age, Treatment, and a Subject Random Intercept
Consider a hypothetical model with \(\eta_{ij}=-2+0.03(\text{age}_i-60)+0.8(\text{treatment}_i)+b_i\), where age is in years, treatment is coded 0 or 1, and \(b_i\) is dimensionless on the log-odds scale. For a 70-year-old treated subject with \(b_i=-0.4\), calculate the conditional probability. Then compare it with the probability for the same subject under control, holding \(b_i\) fixed.
For the treated subject, the age contribution is \(0.03(70-60)=0.30\). Therefore, \(\eta=-2+0.30+0.8-0.4=-1.30\), and \(p=1/(1+\exp(1.30))\approx0.2142\). The predicted event probability at this specified covariate and random-effect value is about 21.42%.
Under control, only the treatment term changes: \(\eta=-2+0.30-0.4=-2.10\). Thus, \(p=1/(1+\exp(2.10))\approx0.1091\), or 10.91%. The conditional odds ratio for treatment is \(\exp(0.8)\approx2.226\), which agrees with the model: treatment multiplies the odds by about 2.226 when the other terms are held fixed. The probability difference is about 10.51 percentage points, not 122.6 percentage points; odds and probabilities are different scales.
Population-Averaged Probabilities
A population-averaged probability for specified covariates averages the conditional probability over the random-effect distribution: \(P(Y_{ij}=1\mid\mathbf{x}_{ij})=\int p_{ij}(b)\phi(b;0,\omega^2)\,db\). It is generally not equal to the probability obtained by substituting the mean random effect \(b=0\). In particular, the logistic function is nonlinear, so applying it to the average linear predictor does not in general equal averaging the logistic probabilities. This distinction is central to the conditional and population-averaged effects discussed in the earlier material on conditional and population-averaged effects in NLME.
Worked Example: Averaging Over Random-Intercept Variability
Suppose the fixed part of the linear predictor is \(-1\) for a particular covariate profile and \(b_i\sim N(0,0.8^2)\). The probability at \(b_i=0\) is \(1/(1+\exp(1))\approx0.2689\). Approximate the population-averaged probability using three-point Gauss-Hermite quadrature for a standard normal: nodes \(0,\pm\sqrt{3}\) with weights \(2/3,1/6,1/6\), respectively.
The corresponding random-intercept values are \(0\) and \(\pm0.8\sqrt{3}\approx\pm1.3856\). The conditional probabilities at these nodes are \(\operatorname{logit}^{-1}(-1)\approx0.2689\), \(\operatorname{logit}^{-1}(-1-1.3856)\approx0.0843\), and \(\operatorname{logit}^{-1}(-1+1.3856)\approx0.5952\).
Applying the quadrature weights gives \((2/3)(0.2689)+(1/6)(0.0843)+(1/6)(0.5952)\approx0.2925\). Thus, this numerical approximation to the population-averaged probability is 29.25%, compared with 26.89% at \(b_i=0\). The difference arises because averaging probabilities over heterogeneous subjects is not the same as evaluating the probability at the mean random effect. Three-point quadrature is an approximation to the integral, not an exact identity for the logistic function.
Diagnostics, Alternatives, and Limitations
A fitted model should be checked for failures that undermine its assumptions or make its estimates unreliable. Warning signs include convergence problems, estimates that change substantially with reasonable starting values, a random-intercept variance estimated near zero, and very large coefficient estimates associated with sparse or nearly separated outcome patterns. Check that outcomes are coded consistently, that subject identifiers correctly link repeated observations, and that subject-level predictors do not vary unexpectedly within a subject. Compare observed and fitted event frequencies across relevant covariate ranges and by subject or visit as appropriate; systematic discrepancies can indicate an inadequate mean structure or dependence structure.
A random-intercept logistic model is not the only way to analyze repeated binary outcomes. Ordinary logistic regression without random effects treats observations as independent and may give inappropriate uncertainty estimates when within-subject dependence is present. A marginal approach such as generalized estimating equations instead targets population-averaged effects, with a working correlation structure used to represent within-subject association. These approaches answer different questions: the mixed-effects model’s coefficients are conditional on random effects, while a marginal model directly targets population-average relationships. Neither approach automatically repairs a poorly specified predictor structure or sparse data.
The random-intercept model also has limitations. It assumes the same subject-specific shift in log odds across all observations and a particular normal distribution for that shift. It may not capture every form of within-subject variation, and estimates can be fragile when there are few subjects, few events, or little covariate overlap. A conditional odds ratio should not be reported as a population-average odds ratio, nor should it be described as a constant probability increase. These interpretations depend on the model and on which probability or effect is being reported.
Define the event coded as 1, the subject-level covariates, their units, and their reference categories.
Write the Bernoulli distribution, logit linear predictor, and random-effect distribution, including the assumed within-subject conditional independence.
Use coefficients for conditional log-odds changes, exponentiated coefficients for conditional odds ratios, and the inverse logit for specified conditional probabilities.
For a population-averaged probability, integrate conditional probabilities over the random-effect distribution rather than setting the random effect to zero.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions.
- A coefficient for a subject-level predictor is \(-0.4\). What is its conditional odds ratio for a one-unit increase?
- For a specified subject, the linear predictor is \(0\). What is the conditional event probability?
- Why is the probability at \(b_i=0\) generally not the population-averaged probability?
- Name one key assumption that connects repeated outcomes from the same subject in a random-intercept model.
Solutions. (1) The odds ratio is \(\exp(-0.4)\approx0.6703\): the conditional odds are multiplied by about 0.6703 per one-unit increase, holding other terms fixed. (2) The inverse logit is \(1/(1+\exp(0))=0.5\), or 50%. (3) The population average integrates inverse-logit probabilities over the random-effect distribution; because the inverse-logit is nonlinear, this average generally differs from its value at the mean random effect. (4) Outcomes are assumed conditionally independent given the covariates and the shared subject random intercept; marginally, that shared intercept induces within-subject dependence.