Nonlinear Mixed Models: Modeling Nonlinear Trajectories Across Clustered and Longitudinal Data

Nonlinear mixed models (NLMMs) extend mixed-effects modeling to situations where the relationship between predictors, time, or covariates and the outcome response is inherently nonlinear in the model parameters, while observations are grouped into clusters, subjects, sites, or repeated time points. In pharmacokinetics, pharmacodynamics, growth and dose-response modeling, ecology, engineering degradation testing, and econometrics, physical and biological processes naturally follow curves defined by structural parameters—such as saturation plateaus, exponential decay, logistic growth, or sigmoidal dose-response curves—rather than straight lines or link-transformed linear predictors. When those curves vary from subject to subject or cluster to cluster, nonlinear mixed models estimate both population-level fixed parameters and subject- or cluster-specific random effects within a unified statistical framework.

Why Standard Linear and Generalized Linear Mixed Models Are Not Enough

Many nonlinear patterns can be handled by adding polynomials or splines to a linear predictor, or by using a link function in a generalized linear mixed model (GLMM). However, inherently nonlinear models arise when parameters enter the mean function nonlinearly in ways that carry direct domain meaning and cannot simply be rewritten as g(μij)=ηijg(\mu_{ij}) = \eta_{ij}g(μij​)=ηij​ with a linear ηij\eta_{ij}ηij​.

Consider an exponential decay or first-order pharmacokinetic curve over time tijt_{ij}tij​ for subject iii:

f(tij,θi)=θ1iexp⁡ ⁣(−θ2itij)f(t_{ij}, \theta_i) = \theta_{1i} \exp\!\bigl(-\theta_{2i} t_{ij}\bigr)f(tij​,θi​)=θ1i​exp(−θ2i​tij​)

Here, θ1i\theta_{1i}θ1i​ represents subject iii’s initial concentration or baseline amplitude, and θ2i\theta_{2i}θ2i​ represents subject iii’s elimination or decay rate. Notice that θ2i\theta_{2i}θ2i​ sits inside the exponent multiplying tijt_{ij}tij​—not as an additive linear term. Modeling θ1i\theta_{1i}θ1i​ and θ2i\theta_{2i}θ2i​ directly with random effects preserves physical interpretability while accounting for between-subject differences in baseline and rate.

Ignoring clustering or fitting separate nonlinear curves to each individual one at a time runs into clear obstacles:

  • Sparse or Noisy Individual Curves: When a subject has few time points or high measurement noise, fitting a separate nonlinear curve per subject can fail to converge or produce extreme parameter estimates.
  • Information Sharing via Random Effects: Pooling information across subjects through random effects stabilizes parameter estimates for individuals with limited data while capturing genuine inter-individual variation.
  • Accurate Population & Predictive Inference: Accounting for correlation within repeated measurements prevents underestimated standard errors and supports realistic predictions for both existing and new subjects.

Mathematical Formulation of Nonlinear Mixed Models

For observation jjj (j=1,…,nij = 1, \dots, n_ij=1,…,ni​) within cluster or subject iii (i=1,…,Mi = 1, \dots, Mi=1,…,M), a common two-stage specification defines the response yijy_{ij}yij​ as:

yij=f(xij,ϕi)+εijy_{ij} = f\bigl(x_{ij}, \phi_i\bigr) + \varepsilon_{ij}yij​=f(xij​,ϕi​)+εij​

where:

  • f(xij,ϕi)f(x_{ij}, \phi_i)f(xij​,ϕi​) is a known nonlinear mean function of predictor vector xijx_{ij}xij​ (often time, dose, or concentration) and subject-specific parameter vector ϕi\phi_iϕi​.
  • ϕi=Aiβ+Biui\phi_i = A_i \beta + B_i u_iϕi​=Ai​β+Bi​ui​ models subject-specific parameters as a combination of fixed effects (β\betaβ) and random effects (ui∼N(0,Ψ)u_i \sim \mathcal{N}(0, \Psi)ui​∼N(0,Ψ)), optionally incorporating subject-level covariates through design matrices AiA_iAi​ and BiB_iBi​.
  • εij\varepsilon_{ij}εij​ is the within-subject residual error term, often assumed normal with variance σ2\sigma^2σ2 (or a variance function modeling heteroscedasticity or serial correlation over time).

Because f(xij,ϕi)f(x_{ij}, \phi_i)f(xij​,ϕi​) is nonlinear in uiu_iui​, the marginal expectation across the random-effects distribution generally does not equal the function evaluated at the mean random effect:

E[f(xij,ϕi)]≠f(xij,E[ϕi])E\bigl[f(x_{ij}, \phi_i)\bigr] \neq f\bigl(x_{ij}, E[\phi_i]\bigr)E[f(xij​,ϕi​)]=f(xij​,E[ϕi​])

This distinction between individual (conditional) curves and population-averaged expectations is central to interpreting nonlinear mixed models accurately.

Comparing NLMMs with Related Mixed and Nonlinear Methods

Modeling ApproachHow Parameters Enter the MeanPrimary Use CaseKey Strength & Trade-Off
Linear Mixed Model (LMM)Linear in fixed & random parameters (Xβ+Zu)Continuous Gaussian outcomes with linear/basis predictorsClosed-form structure & well-established diagnostics; not built for nonlinear parameter curves
Generalized Linear Mixed Model (GLMM)Linear predictor inside link function g(μc)=Xβ+ZuNon-normal outcomes (binary, counts, proportions) via linkHandles non-Gaussian likelihoods & links; linear predictor lacks mechanistic parameter curves
Nonlinear Mixed Model (NLMM)Inherently nonlinear in parameters f(xij​,ϕi​(ui​))Mechanistic curves (PK/PD, growth, decay, dose-response)Interpretable structural parameters & shrinkage across subjects; harder numerical integration
Nonlinear Least Squares (Per Group)Nonlinear in parameters, fit separately per group/subjectQuick individual curve inspection when data per group is richSimple per-subject fit; unstable when group sample sizes are small and ignores hierarchy

Estimation Methods and Convergence Challenges

Fitting a nonlinear mixed model requires integrating over the random effects uiu_iui​ inside a nonlinear function:

p(yi∣β,Ψ,σ2)=∫[∏j=1nip(yij∣ui,β,σ2)]p(ui∣Ψ) duip(y_i \mid \beta, \Psi, \sigma^2) = \int \left[\prod_{j=1}^{n_i} p\bigl(y_{ij} \mid u_i, \beta, \sigma^2\bigr)\right] p(u_i \mid \Psi)\, du_ip(yi​∣β,Ψ,σ2)=∫[j=1∏ni​​p(yij​∣ui​,β,σ2)]p(ui​∣Ψ)dui​

Because this integral rarely has a closed form, software relies on numerical or approximate estimation techniques:

  • Linearization Methods (First-Order / Lindstrom–Bates): Linearize the model around current estimates of random effects (such as zero or conditional modes), turning each iteration into a linear mixed-effects subproblem. Fast and widely used, though accuracy can degrade when nonlinearity or random-effect variance is large.
  • Adaptive Gauss–Hermite Quadrature: Approximates the integral via weighted quadrature nodes centered and scaled around each cluster’s conditional mode. High accuracy for low-dimensional random effects, though computation grows rapidly as random-effect dimension increases.
  • Stochastic Approximation (SAEM) and Bayesian MCMC: Use stochastic expectation-maximization or Markov chain Monte Carlo sampling to handle complex nonlinear hierarchies and multi-dimensional random effects cleanly.

Because nonlinear optimization surfaces can have flat ridges, local optima, or non-identifiable parameters, good starting values—often obtained by fitting preliminary curves on aggregated or subset data—are critical for reliable convergence.

Practical Workflow and Best Practices

A disciplined workflow for nonlinear mixed models helps avoid convergence stalls and misinterpretation:

  1. Start from Domain Curves and Check Identifiability: Choose a structural function f(x,ϕ)f(x, \phi)f(x,ϕ) grounded in domain theory, verify that all parameters in ϕi\phi_iϕi​ are identifiable from the observed design (for example, enough time points to estimate both asymptote and rate), and compute sensible starting values.
  2. Build Random Effects Incrementally: Begin with fixed effects and random effects on only the best-supported parameters (such as baseline or rate), then test additional random effects or covariance structures carefully rather than over-parameterizing random slopes/correlations immediately.
  3. Inspect Residuals, Random Effects, and Convergence: Check convergence status, gradients, standard errors, residual plots (including heteroscedasticity or autocorrelation over time), and random-effect distributions for skewness, outliers, or near-zero variances.
  4. Present Both Individual and Population Behavior: Plot observed trajectories alongside subject-specific fits and population curves, and explain clearly whether summaries describe individual parameter distributions or marginal averages.

Conclusion

Nonlinear mixed models bring together mechanistic or inherently nonlinear parameter curves and hierarchical random-effects modeling for grouped and longitudinal data. By sharing information across subjects or clusters while preserving interpretable structural parameters, NLMMs give analysts a rigorous tool for modeling growth, decay, response curves, and time-dependent processes in complex applied datasets.