Family and Link Answer Different Questions
In a generalized linear mixed model, the family describes the conditional distribution of the outcome, while the link connects its conditional mean to a linear predictor. These choices are related but not interchangeable. For example, selecting a binomial family says that the response is binary or a binomial count; selecting a logit link says how the conditional probability is represented on the linear-predictor scale.
For observation \(i\) in cluster \(j\), a common GLMM structure is a conditional outcome distribution given random effects, together with a predictor such as \(\eta_{ij}=\mathbf{x}_{ij}^{\mathsf T}\boldsymbol{\beta}+\mathbf{z}_{ij}^{\mathsf T}\mathbf{b}_j\). Here \(\mathbf{x}_{ij}\) and \(\mathbf{z}_{ij}\) are covariate vectors, \(\boldsymbol{\beta}\) contains fixed effects, and \(\mathbf{b}_j\) contains cluster-specific random effects. The link \(g\) specifies \(g(\mu_{ij})=\eta_{ij}\), where \(\mu_{ij}\) is the conditional mean of the response given the random effects. The conditional distribution and the link must both make sense for the outcome and scientific question.
The examples below assume observations are conditionally independent given the random effects and covariates, and that the random effects follow the distribution specified by the model (commonly a mean-zero multivariate normal distribution). They also assume that the outcome has been encoded and measured as intended. A correct R call cannot compensate for an incorrect observation unit, outcome coding, or cluster identifier.
Binary Outcomes: Binomial Family and Logit Link
For a binary outcome coded 0 or 1, the conditional distribution is Bernoulli, which is the one-trial case of the binomial distribution. The conditional mean is the probability of a 1, \(p_{ij}=P(Y_{ij}=1\mid \mathbf{b}_j,\mathbf{x}_{ij})\). With a logit link, the model is
In lme4, a representative specification is lme4::glmer(event ~ treatment + (1 | clinic), data = d, family = binomial(link = "logit")). The formula describes the fixed and random effects; the family argument specifies the binomial response distribution and logit link. This line specifies a model. It does not, by itself, report estimates or establish that the model fits the data well.
Worked Example: Specifying and Mapping a Binary Model
Suppose a hypothetical data set has one row per patient, a 0/1 indicator named event, a treatment indicator named treatment, and a clinic identifier named clinic. The intended model is a clinic random-intercept logistic GLMM. A suitable call is glmer(event ~ treatment + (1 | clinic), data = d, family = binomial(link = "logit")). The binary coding supports a Bernoulli response, and the clinic identifier supports the stated clustering structure.
To illustrate the link transformation only, suppose an already specified model has conditional predictor \(\eta=-1.20+0.60x+0.40b\), where \(x=1\) for treatment and the clinic random intercept for this hypothetical clinic is \(b=0.25\). Then \(\eta=-1.20+0.60(1)+0.40(0.25)=-0.50\), and the conditional probability is
Thus, under these illustrative coefficients and this clinic effect, the model-implied probability is about 0.378. This is not a probability calculated from the R call alone, nor is it an estimate from actual study data. The fixed treatment coefficient is on the log-odds scale; understanding that scale is different from choosing family = binomial(link = "logit").
Count Outcomes: Poisson Family and Log Link
For a nonnegative integer count measured over a defined observational unit, a common starting model uses a Poisson conditional distribution and the log link. If \(Y_{ij}\) is the count and \(\mu_{ij}=E(Y_{ij}\mid\mathbf{b}_j,\mathbf{x}_{ij})\), the Poisson model assumes \(Y_{ij}\mid\mathbf{b}_j,\mathbf{x}_{ij}\sim\operatorname{Poisson}(\mu_{ij})\), with conditional variance equal to its conditional mean. The log link ensures the model-implied mean is positive:
A representative glmer specification is glmer(count ~ treatment + (1 | clinic), data = d, family = poisson(link = "log")). This is appropriate as a starting specification when the response consists of counts and the conditional Poisson assumptions are plausible. It does not establish that those assumptions hold. A count whose conditional variability substantially exceeds its mean, for example, can call for reconsideration of the model rather than mechanically keeping a Poisson family.
Worked Example: A Count Model and Its Conditional Mean
Consider a hypothetical data set containing the number of visits per patient during a fixed observation period, a treatment indicator, and a clinic identifier. Each response is a nonnegative integer, and the clinic random intercept represents the intended grouping. A candidate call is glmer(visits ~ treatment + (1 | clinic), data = d, family = poisson(link = "log")). The fixed observation period makes the count unit clear; if patients had different observation times, that issue would need to be represented in the model rather than ignored.
For illustration, suppose the linear predictor is \(\eta=0.30+0.20x+0.15b\). For \(x=1\) and \(b=-0.40\), \(\eta=0.30+0.20(1)+0.15(-0.40)=0.44\). The corresponding conditional mean is
The model-implied conditional mean is about 1.55 visits during the specified period, not a guarantee that an individual has 1.55 visits. The Poisson family additionally implies conditional variance \(1.553\) at these covariate and random-effect values. A marked mismatch between observed conditional variability and that implication is a warning about the family assumptions, not a reason to reinterpret the link.
Ordinal Outcomes: Cumulative Links
An ordinal response has ordered categories, such as mild, moderate, and severe, but the distances between categories are not assumed to be equal. It should not ordinarily be supplied to a binomial model as if it were simply a binary outcome, or treated as a numerical count merely because categories have been coded 1, 2, and 3. A common approach is a cumulative link mixed model, which models cumulative category probabilities using one threshold for each category boundary.
With the logit cumulative link and thresholds \(\theta_k\), a common convention is
The \(\theta_k\) values are ordered thresholds, and the same predictor effect is used across category boundaries in this proportional-odds form. This is not the same structure as a binary logistic model with a separate response for each category. In R, the ordinal package's clmm function specifies the cumulative link directly, for example ordinal::clmm(rating ~ treatment + (1 | clinic), data = d, link = "logit"). Unlike the glmer calls above, the link is supplied as a direct argument; the model is not specified with a family argument. The package and function are part of the model specification, not just alternative spellings of a glmer family.
Worked Example: Choosing a Link for an Ordered Rating
Suppose hypothetical patients rate symptom severity as mild, moderate, or severe, stored as an ordered factor. Patients are nested within clinics, and the scientific aim is to model shifts in the ordered response. A cumulative logit mixed model is a defensible candidate: ordinal::clmm(rating ~ treatment + (1 | clinic), data = d, link = "logit"). The ordered factor preserves category order without assuming equal spacing; the clinic term represents clustering.
For a transparent calculation, suppose one fitted or illustrative cumulative equation at the mild-to-moderate boundary has threshold \(\theta_1=0.80\), and the predictor for a particular patient and clinic is \(\eta=0.30\). Then
This gives a model-implied conditional probability of about 0.623 for being in the mild category or below the boundary. Because mild is the lowest category here, that cumulative event is just mild. The calculation demonstrates the threshold-and-link structure; it does not turn category labels into equally spaced scores. Under the stated sign convention, a larger \(\eta\) decreases \(P(Y\leq k)\), shifting probability toward higher categories.
A Practical Specification Check
Before fitting, verify that the response encoding, family, link, and R function agree. The following distinctions prevent many avoidable errors.
| Outcome | Candidate model structure | R specification pattern | Key implication to check |
|---|---|---|---|
| Binary 0/1 response | Bernoulli, a one-trial binomial model | glmer(..., family = binomial(link = "logit")) | Conditional probability lies between 0 and 1 |
| Nonnegative integer count | Poisson with log link, if its assumptions are plausible | glmer(..., family = poisson(link = "log")) | Conditional mean is positive; Poisson conditional variance equals that mean |
| Ordered categories | Cumulative link mixed model | clmm(..., link = "logit") | Category order is used; equal spacing is not assumed |
The logit link is not synonymous with the binomial family: other links can be used with binomial responses, and a logit link alone does not specify a response distribution. Likewise, a log link does not by itself make an outcome Poisson. R syntax should be read as a compact declaration of a statistical model, not as a label from which to infer all its assumptions.
Diagnostics, Alternatives, and Limits
A selected family is a working assumption to assess, not a conclusion guaranteed by software. For binary models, inspect whether the response is truly coded as 0/1 (or represented with the intended binomial denominator) and whether there are sparse outcome patterns that make the fitted model unstable. For counts, check for impossible negative or fractional values, understand the time or area over which counts were collected, and examine whether the Poisson variance assumption is plausible. For ordinal models, verify that the categories are ordered correctly and that the proportional-odds structure is a reasonable simplification. Residual and simulation-based checks can help reveal discrepancies, but no single diagnostic proves a model correct.
The main alternative is not always “use a different link.” A different link changes the shape of the relationship between predictors and the mean, while a different family changes the outcome distribution and its variance structure. For ordinal data, using a cumulative link model respects ordering; treating the categories as nominal discards that order, while assigning scores and fitting a numeric-response model adds an equal-spacing assumption. Each choice answers a different modeling question.
Common failure modes include supplying an unordered character variable when an ordered response is intended, leaving a binary response coded as text, or choosing Poisson solely because the response column contains integers. A model can run successfully and still be conceptually mismatched. Check data types, observed category levels, cluster identifiers, and the substantive meaning of one row before trusting the model call.
- Wrong reasoning: “The categories are stored as 1, 2, and 3, so a Poisson model is appropriate.”
- Correction: Numeric storage does not define the outcome scale. If the values represent ordered categories without meaningful equal intervals, use an ordinal model that represents their ordering.
- Wrong reasoning: “The code contains
link = "logit", so it is a logistic model regardless of family.” - Correction: The link and family are separate components. State both, and check that the response distribution and mean range match the outcome.
Finally, model specification and coefficient interpretation are separate tasks. A family and link declare the assumed relationship; interpretation requires the fitted coefficient values, the link's scale, the random-effects structure, and the chosen reference levels. In particular, a coefficient on the linear-predictor scale is not automatically a change in probability or an absolute change in the observed outcome.
Check Your Understanding
Answer each question, then compare with the solutions.
- A 0/1 response records whether a hypothetical patient experienced an event. Give a suitable family and link for a logistic random-intercept model.
- A count model has \(\eta=0.25\) for an observation and uses a Poisson family with a log link. What is its conditional mean, to three significant figures?
- A symptom outcome has ordered categories with no meaningful equal spacing. Why is a cumulative link model generally more suitable than treating the category codes as Poisson counts?
- In a cumulative logit model, \(\operatorname{logit}\{P(Y\leq k)\}=\theta_k-\eta\). If \(\theta_k=1.10\) and \(\eta=0.40\), calculate \(P(Y\leq k)\) to three significant figures.
Solutions. (1) Use a binomial family with a logit link, such as family = binomial(link = "logit") in a suitable glmer model; the response coding and cluster term must match the data. (2) \(\mu=\exp(0.25)\approx 1.284\), or 1.28 on rounding. (3) The cumulative link uses category ordering without assuming equal spacing, whereas a Poisson count model treats values as counts and imposes a count distribution and mean-variance relationship. (4) The cumulative logit is \(1.10-0.40=0.70\), so \(P(Y\leq k)=\exp(0.70)/(1+\exp(0.70))\approx 0.668\).