When to Use GLMs vs GLMMs

    Forcing non-normal responses into ordinary linear regression distorts means, variances, and inference. This article explains how generalized linear models (GLMs) handle exponential-family responses with a linear predictor on the link scale, when generalized linear mixed models (GLMMs) are needed once independence fails, and a practical sequence for choosing distribution, link, and random effects.

    Putting a non-normal response straight into ordinary linear regression is often not “approximately fine.” Means, variances, and inference can all be distorted at once. A generalized linear model (GLM) addresses a wider exponential family of responses while still explaining the mean through a linear predictor and a monotone link. A generalized linear mixed model (GLMM) then asks a different question: can the observations still be treated as independent? The two are not a “beginner vs advanced” pair; they are separated by whether the independence assumption holds.

    What a GLM is modeling

    For observation (i), write the response as (Y_i) and the mean as (\mu_i = E(Y_i)). A GLM does not set (\mu_i) equal to a linear combination of covariates. It sets

    [g(\mu_i)=\eta_i=x_i^\top\beta]

    where (g) is a known smooth, strictly monotone link, (x_i) is row (i) of the design matrix, and (\beta) holds the fixed effects. Observations are usually assumed independent, and (Y_i) belongs to an exponential family: normal, Poisson, binomial, gamma, and others. The point of the exponential family is not a convenient label; it is a unified log-likelihood in the mean parameter, so score equations, information matrices, and iteratively reweighted least squares can share one algorithm.

    Specifying a GLM therefore adds two choices relative to a linear model: the distribution and the link. The distribution determines how variance changes with the mean; the link determines whether the linear predictor explains the mean itself, the log mean, or a transformation of a success probability. Identity link, normal distribution, and constant variance recover ordinary linear regression as a special case. A GLM does not abandon linearity; it moves linearity from the response scale to the link scale.

    In practice there are three scales that must not be mixed. The linear predictor (\eta) is unbounded, which is convenient for main effects and interactions. The mean (\mu) must lie in the range allowed by the distribution (nonnegative counts, proportions in ((0,1))). The response (Y_i) still carries sampling variation. Coefficients are most direct on the (\eta) scale; business interpretation often has to return to the (\mu) scale. Skipping that step turns “log incidence rate increases by 0.2” into “case counts increase by 0.2.”

    When fixed effects are enough

    In an early epidemic phase, if expected daily incidence grows approximately exponentially, write (\mu(t)=\gamma\exp(\delta t)). After a log,

    [\log\mu(t)=\beta_0+\beta_1 t]

    with (\beta_0=\log\gamma) and (\beta_1=\delta). The right-hand side is already linear in the parameters. The response is a daily count, variance often rises with the mean, and Poisson with a log link is a natural start: the linear predictor is simply (\beta_0+\beta_1 t). All dates share one deterministic log-linear trend. If dates do not share unobserved common shocks, a GLM is enough. The model answers the overall time trend, not how much particular regions deviate.

    Another case is a saturating curve. Captures (y_i) rise with prey density (x_i), but handling time bounds the mean toward a plateau. A linearizable form puts the remaining fraction of the plateau on a log or reciprocal scale so a few parameters still enter the linear predictor. If the scientific mean cannot be rewritten as a linear predictor under a single link, it should not be forced into a GLM; use a nonlinear model. The test is concrete: after the chosen link, does a transformation of the mean equal a linear combination of covariates? If yes, it is a GLM; if not, it is only a parametric model with a nonlinear mean.

    Independence broken: then a GLMM

    A GLMM stands to a GLM as a linear mixed model stands to ordinary linear regression. It still uses an exponential family and a link, but the linear predictor becomes

    [g(\mu_i)=x_i^\top\beta+z_i^\top b_i]

    where (b_i) are random effects, usually mean-zero multivariate normal with covariance to be estimated, and (z_i) indicates group, repeated measure, or trial. Conditional on (b_i), responses remain independent in the GLM sense; unconditionally, observations in the same group are correlated. That correlation is not fully captured by adding a group dummy as a fixed effect. Fixed dummies estimate the levels of those specific groups; random effects estimate a distribution of between-group variation and share information across groups, which is especially useful when there are many groups and few observations per group.

    Typical structures that need random effects include repeated reports from the same hospital, repeated samples from the same plot, longitudinal measures on the same subject, and batches that share unmeasured operational differences. If a GLM is used as if observations were independent, standard errors tend to be too small, significance is inflated, and prediction intervals fail to cover the uncertainty of a new group. A GLMM splits uncertainty in two: within-group sampling variation from the exponential family, and between-group heterogeneity from the random-effect variance.

    Random effects are not better when piled on. They consume information and require integration or approximate inference. Add them only when the design has clustering, repeats, or hierarchy, and that dependence enters the inference you care about. If groups are a few known categories and you care only about those categories, fixed effects are usually clearer. If conclusions must generalize to new hospitals, plots, or subjects, random effects match the target population.

    A workable selection sequence

    First, look at the support of the response. Unbounded, roughly symmetric, stable variance: start with a normal model and identity link. Nonnegative and right-skewed: gamma or inverse Gaussian with a log link, with extra care on the variance function. Counts: Poisson or negative binomial thinking to check overdispersion. Successes in a finite number of trials: binomial. Do not choose normal only because a histogram looks bell-shaped.

    Second, write the scientific form of the mean, then ask whether a monotone link turns it into a linear predictor. Exponential growth, log odds, and log rates usually can; saturating curves whose parameters nest as products or ratios often cannot. If it linearizes, stay in a GLM or GLMM; if not, do not hide a misspecified mean behind a link.

    Third, sketch the dependence graph of the data. If residuals still cluster by individual, time, or space, and the design matrix has no corresponding fixed structure, consider random intercepts, random slopes, or a simpler working correlation. Random intercepts allow different group baselines; random slopes allow covariate effects to vary by group. Both can appear together, but there must be enough groups to estimate the variance components. With very few groups, those components are unreliable.

    Fourth, after conditional independence, check dispersion. Poisson or binomial GLMs often show variance larger than the mean function implies (overdispersion). Causes include missing covariates, excess zeros, unmodeled clustering, or a wrong family. If overdispersion comes from unmodeled between-group differences, a GLMM usually matches the design better than inflating a dispersion parameter in a GLM. If leftover extra variation is independent, a dispersion parameter or a negative binomial extension may be simpler. Use grouped residual plots to locate the source, then choose the tool.

    Boundaries for estimation, comparison, and interpretation

    A GLM likelihood can usually be written directly; estimation is constrained optimization, and iteratively reweighted least squares is stable under canonical links. A GLMM’s marginal likelihood integrates over random effects; most combinations have no closed form, so practice relies on Laplace approximation, adaptive quadrature, or sampling. Standard errors of coefficients, random-effect variances, and information criteria therefore depend on approximation quality. Strong within-group correlation, few groups, or high-dimensional random effects make approximation bias non-negligible. Report fixed-effect point estimates, what they mean on the link scale, and whether variance components are identifiable—not only a (p)-value.

    Compare models on the same data and the same response assumptions. Nested fixed effects can use likelihood ratios, but random-effect variances sit on a boundary (they cannot be negative); ordinary chi-square approximations can be conservative or anti-conservative depending on whether the null is on the boundary of the parameter space. Non-nested models are better judged by out-of-sample prediction: log scores or calibrated intervals for counts; for grouped data, hold out entire groups rather than random rows, or within-group correlation leaks into the validation set and inflates apparent accuracy.

    Coefficient interpretation also has two layers. In a GLM, under a log link (\beta_1) is the change in (\log\mu) for a one-unit covariate change, and (\exp(\beta_1)) is a mean multiplier. In a GLMM the same (\beta) is typically a conditional effect given the random effects—“for the same group”—and need not equal a marginal effect that pools all groups. Stating a conditional effect as a population-average effect is a common error. If a population-average reading is required, average over the random-effect distribution; do not quote only the conditional coefficient.

    How the two examples should be rewritten

    If disease incidence is a single overall curve and dates can be treated as conditionally independent, a Poisson log GLM matches early exponential growth. Once data come from many regions with different reporting habits, population structure, and intervention timing, treating every point as independent Poisson understates uncertainty in the trend slope. A more reasonable model uses region random intercepts for baseline level and, if needed, region-specific time slopes; the fixed part remains a time term on the log link. Exponential growth stays in the linear predictor, while a new region may shift or steepen the curve.

    If each predator contributes one density point and the saturating mean is already linear on the link scale, a GLM can compare density effects. If the same predator is tested at several densities, individual vigor shares a random level across observations; an independent GLM can mistake “this animal is especially good at catching prey” for a density effect. A random-intercept GLMM puts individual differences in (b_i), so the density coefficient is closer to a typical individual’s response. Random slopes for the plateau itself are warranted only if that parameter varies by individual and there are enough groups; with too few groups, prefer a smaller random structure over a variance component held up only by approximation.

    A minimal checklist at implementation

    Before writing the model, answer in one sentence: what distribution the response has, which part is linear after the link, and at which unit the correlation arises. After fitting, do not stop at the coefficient table. Check at least: whether link-scale residuals still show systematic shape against fitted values or groups; whether the variance–mean relationship matches the chosen distribution; whether predicted random effects have extreme groups that suggest mis-grouping; whether dropping the largest group leaves the direction of fixed effects stable. For count models, check separately whether the share of zeros is explained by the current mean structure.

    If the goal is prediction for groups already seen, conditional prediction can use that group’s random effects. If the goal is a brand-new group, the random-effect variance must enter the prediction interval, which will be substantially wider. That is not a worse model; the target changed. The narrow GLM interval is false confidence for the second goal.

    The operational rule: exponential family plus link, and observations independent under that model, use a GLM. Same mean structure but group-level correlation that must be acknowledged, and inference that should generalize to a population of groups, use a GLMM. Distribution and link shape mean and variance; random effects shape correlation and the scope of generalization. Write those three things clearly before algorithms and significance, so the model does not fit well while answering the wrong question.