Tutorials › Nonlinear Mixed-Effects Models (NLME) › Link Functions for Non-Continuous Mixed-Effects Models

Categorical, Count and Time-to-Event Responses · Tutorial 419 of 797

Link Functions for Non-Continuous Mixed-Effects Models

See how four common link functions map individual predictors to probabilities or means, and how their shapes and response scales differ.

Advanced 11 min read

What You'll Learn

  • Define a link function as a map from a response mean to an individual-specific predictor.
  • Invert logit, probit, complementary log-log, and log links.
  • Check which response scales each inverse link can represent.
  • Compare the probability curves produced by logit, probit, and complementary log-log links.
  • Interpret how a log link changes a positive conditional mean.
  • Recognize invalid predictions and other signs of a link–response mismatch.

Why Link Functions Are Needed

A mixed-effects model for a non-continuous response must connect an individual’s covariates and random effects to a response probability or mean. A straight-line predictor can take any real value, but a probability must lie between zero and one, and a positive mean must be greater than zero. A link function makes this connection by transforming the response mean onto a scale where the predictor can take any real value.

Let \(Y_{ij}\) denote the response for individual \(i\) at observation \(j\), and let \(\mu_{ij}=E(Y_{ij}\mid b_i)\) be its conditional mean given that individual’s random effects \(b_i\). Write \(\eta_{ij}\) for the individual-specific predictor. A common form is \(\eta_{ij}=x_{ij}^{T}\beta+z_{ij}^{T}b_i\), where \(x_{ij}\) and \(z_{ij}\) are covariate vectors, \(\beta\) is a fixed-effects parameter vector, and \(b_i\) is an individual random-effects vector. More generally, the predictor may be a nonlinear function of covariates and parameters. The link specifies how \(\mu_{ij}\) and \(\eta_{ij}\) are related; it does not, by itself, specify the response distribution or the random-effects distribution.

Definition: A link function \(g\) relates the conditional response mean to the individual-specific predictor by \(g(\mu_{ij})=\eta_{ij}\). Its inverse \(g^{-1}\) maps the predictor back to the response scale: \(\mu_{ij}=g^{-1}(\eta_{ij})\). For a binary response, \(\mu_{ij}\) is the conditional probability of the event; for a count response, it is the conditional expected count.

The key requirement is that the inverse link maps every permitted predictor value to a value allowed by the response mean. This is why the choice of link is tied to the response scale. The four links in this tutorial are widely used, but they are not interchangeable: their inverse functions have different shapes and, for the log link, a different range.

Four Links and Their Response Scales

For a binary response, write \(p_{ij}=P(Y_{ij}=1\mid b_i)\). The logit, probit, and complementary log-log links each map \(0<p_{ij}<1\) to an unrestricted real-valued predictor. Their inverse functions therefore produce valid probabilities for any finite \(\eta_{ij}\).

Definition: The logit link is \(g(p)=\log\{p/(1-p)\}\), with inverse \(g^{-1}(\eta)=1/(1+\exp(-\eta))\). The probit link is \(g(p)=\Phi^{-1}(p)\), with inverse \(g^{-1}(\eta)=\Phi(\eta)\), where \(\Phi\) is the standard normal cumulative distribution function. The complementary log-log link is \(g(p)=\log\{-\log(1-p)\}\), with inverse \(g^{-1}(\eta)=1-\exp\{-\exp(\eta)\}\).

All three inverse links are increasing, but they do not assign the same probability to a given predictor. The logit curve is symmetric around \((0,0.5)\). The probit curve is also symmetric around that point, but its shape differs from the logistic curve. The complementary log-log curve is asymmetric: it approaches zero and one at different rates. Consequently, choosing a link affects the model’s assumed response curve, not merely the way its equation is written.

The complementary log-log link also has a useful event-probability interpretation. If an event occurs according to a constant hazard \(\lambda_{ij}\) over an interval of length \(\Delta\), then the probability of at least one event in that interval is \(p_{ij}=1-\exp(-\lambda_{ij}\Delta)\). Setting \(\eta_{ij}=\log(\lambda_{ij}\Delta)\) gives \(p_{ij}=1-\exp\{-\exp(\eta_{ij})\}\), the complementary log-log inverse. This interpretation depends on the constant-hazard-over-the-interval assumption; the link alone does not establish that assumption.

For a positive conditional mean, a common choice is the log link. Unlike the three probability links, it is not a probability model: its inverse produces positive values with no upper bound. That range is appropriate for a positive expected count or rate, but not generally for a probability.

Definition: The log link is \(g(\mu)=\log(\mu)\), with inverse \(g^{-1}(\eta)=\exp(\eta)\). For every finite predictor, the resulting mean is positive, but it may be greater than one.

Worked Example: Comparing Three Probability Links

Suppose, hypothetically, that a binary event is modeled for an individual with predictor \(\eta=-0.70\). The same predictor has different meanings on different link scales, so calculate the probability under each link rather than assuming the probabilities coincide.

Logit: \(p=1/(1+\exp(-\eta))\). Substituting \(\eta=-0.70\) gives \(p=1/(1+\exp(0.70))=1/(1+2.014)=0.3318\).

Probit: \(p=\Phi(\eta)=\Phi(-0.70)\approx0.2420\).

Complementary log-log: First, \(\exp(-0.70)\approx0.4966\). Then \(p=1-\exp\{-\exp(-0.70)\}=1-\exp(-0.4966)\approx1-0.6086=0.3914\).

All three values are valid probabilities, but they differ substantially at this predictor. These are hypothetical model-based conditional probabilities, not three estimates of one probability from observed data. The link must be selected and interpreted as part of the response model.

How the Inverse Links Preserve the Response Scale

The probability links are valid because their inverse functions stay in the probability range. For the logit inverse, \(\exp(-\eta)>0\), so its denominator \(1+\exp(-\eta)\) is greater than one. Thus \(0<1/(1+\exp(-\eta))<1\). For the probit inverse, a cumulative distribution function takes values strictly between zero and one at every finite real argument. For the complementary log-log inverse, \(\exp(\eta)>0\), so \(0<\exp\{-\exp(\eta)\}<1\), and subtracting this quantity from one also gives a value strictly between zero and one.

The log link preserves positivity because \(\exp(\eta)>0\) for every real \(\eta\). These range properties matter in an NLME model because the random effects change the individual predictor. No matter what finite value the random-effects contribution gives that predictor, the inverse link still returns a value on its required scale. This guarantee concerns the range, not whether the resulting predictions fit the data or whether the chosen response distribution is appropriate.

1
State the response mean.
Determine whether the model needs a probability, a positive expected count, or another response-scale quantity.
2
Form the individual predictor.
Combine the relevant covariate and random-effects contributions to obtain \(\eta_{ij}\), conditional on \(b_i\).
3
Apply the inverse link.
Calculate \(\mu_{ij}=g^{-1}(\eta_{ij})\) and verify that it lies on the response’s permitted scale.

This sequence makes explicit a useful distinction: the predictor is on the link scale, while the mean is on the response scale. A value of \(\eta_{ij}=0.5\), for example, is not itself a probability or an expected count. It must be transformed using the selected inverse link.

Worked Example: A Log-Linked Conditional Mean

In a hypothetical count model, suppose the expected count during a one-hour interval has log-linked predictor \(\eta_{ij}=\log(8)+0.20x_{ij}+b_i\). For an individual with \(x_{ij}=1\) and random effect \(b_i=0.10\), calculate the conditional mean count.

Substitution gives \(\eta_{ij}=\log(8)+0.20(1)+0.10=\log(8)+0.30\). The inverse log link is the exponential, so \(\mu_{ij}=\exp\{\log(8)+0.30\}=8\exp(0.30)\approx8(1.350)=10.80\) expected counts during the one-hour interval.

The mean need not be an integer even though an observed count is an integer. The covariate contribution of \(0.20\), holding the other terms fixed, multiplies the mean by \(\exp(0.20)\approx1.221\). This is a statement about the conditional mean under the model, not a claim that each individual’s observed count increases by a fixed amount.

Interpreting Shape and Choosing Among Links

The links differ in how quickly probabilities change as the predictor changes. For the logit inverse, the derivative with respect to \(\eta\) is \(p(1-p)\); for probit it is the standard normal density evaluated at \(\eta\); for complementary log-log it is \(\exp(\eta)\exp\{-\exp(\eta)\}\). Each derivative is positive, so each probability increases with the predictor. Their different derivative patterns explain why the curves can yield different predictions, especially away from the center.

For the log link, \(\mu=\exp(\eta)\), and the derivative is \(\mu\). A fixed increase \(c\) in the predictor multiplies the mean by \(\exp(c)\), because \(\exp(\eta+c)=\exp(c)\exp(\eta)\). This multiplicative structure is often useful for positive means and rates. It also means that an additive predictor change has a larger absolute effect when the starting mean is larger.

Worked Example: Matching a Link to an Event-Interval Interpretation

Suppose, hypothetically, that an event has a constant hazard of \(0.50\) per hour over a one-hour interval. Under the constant-hazard assumption, the probability of at least one event during the interval is \(1-\exp(-0.50\times1)\).

The calculation is \(p=1-\exp(-0.50)\approx1-0.6065=0.3935\). The complementary log-log predictor is \(\eta=\log(0.50\times1)=\log(0.50)\approx-0.6931\). Applying its inverse gives \(1-\exp\{-\exp(-0.6931)\}=1-\exp(-0.50)\approx0.3935\), as expected.

This example shows why the complementary log-log link can be appropriate when event probabilities over intervals are generated by a constant hazard. If the hazard varies within the interval, or the scientific event process is not consistent with this interpretation, the calculation does not justify the link by itself.

LinkTypical mean scaleInverse linkImportant feature
LogitBinary probability\(1/(1+\exp(-\eta))\)Symmetric probability curve; predictor is log odds
ProbitBinary probability\(\Phi(\eta)\)Symmetric probability curve based on the normal distribution function
Complementary log-logBinary event probability\(1-\exp\{-\exp(\eta)\}\)Asymmetric probability curve; can represent constant-hazard interval events
LogPositive mean or rate\(\exp(\eta)\)Positive, unbounded mean; predictor changes act multiplicatively

The link is only one part of the model specification. A link that produces valid probabilities does not guarantee that the assumed binary response distribution, random-effects structure, or predictor is suitable. Similarly, a positive mean from a log link does not establish that a particular count distribution is appropriate. Those assumptions must be specified and assessed separately. In repeated-measures models, the predictor and mean here are conditional on the individual random effects; averaging over individuals is a different operation and should not be confused with this mapping.

Diagnostics, Limitations, and Common Mistakes

A first check is mathematical: calculate predictions on the response scale and verify that they are valid. A probability outside \([0,1]\) signals an implementation error or an unsuitable mapping; the log link cannot be used as an unrestricted probability link because \(\exp(\eta)>1\) whenever \(\eta>0\). For a positive mean, a nonpositive prediction would likewise contradict the log-link mapping and indicate a calculation or implementation problem.

A valid range does not establish good fit. Predictions that cluster extremely close to zero or one may be sensitive to small changes in the predictor, and predicted event frequencies should be checked against observed frequencies across relevant covariate or predictor ranges. For count outcomes, compare predicted means with observed counts in context and check whether the response distribution represents the data’s variability. Such checks address model adequacy; they do not change the inverse-link formulas.

A common mistake is to treat the link-scale predictor as if it were already on the response scale. For example, saying “the probability is \(-0.70\)” from a logit predictor of \(-0.70\) is incorrect. The correction is to apply the logit inverse, which gives a probability of approximately \(0.3318\). Another mistake is to choose a link solely because it returns a valid range. Several links can return valid probabilities, but their curve shapes and scientific interpretations differ. The response scale, the expected relationship, and the assumptions supporting an interpretation should all guide the choice.

Key takeaway: The link transforms a conditional response mean to the predictor scale; the inverse link returns it to the response scale. Logit, probit, and complementary log-log map finite predictors to valid probabilities, while the log link maps them to positive, unbounded means. A valid range is necessary, but does not alone make a model appropriate.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions.

  1. For a probit model with predictor \(\eta=0\), what is the conditional event probability?
  2. For a log-linked mean, what happens to the mean when the predictor increases by \(\log(2)\), with other terms fixed?
  3. Why is an unrestricted log link generally unsuitable for a binary probability?
  4. Under a constant hazard of \(0.20\) per hour, calculate the probability of at least one event in a two-hour interval and give its complementary log-log predictor.
  5. Does an inverse link that returns valid probabilities prove that the entire mixed-effects model fits well? Explain briefly.

Solutions. (1) \(\Phi(0)=0.5000\). (2) The mean is multiplied by \(\exp\{\log(2)\}=2\). (3) The inverse log link is \(\exp(\eta)\), which exceeds one for any \(\eta>0\), so it cannot guarantee a valid probability for an unrestricted predictor. (4) The integrated hazard is \(0.20\times2=0.40\), so \(p=1-\exp(-0.40)\approx1-0.6703=0.3297\); the complementary log-log predictor is \(\eta=\log(0.40)\approx-0.9163\). (5) No. Range validity is only a mathematical property of the inverse link; response-distribution assumptions, predictor specification, random-effects structure, and fit to observed data still require consideration.