Tutorials › Generalized Linear Mixed Models (GLMM) › Link Functions Map Means to Linear Predictors

From GLM to GLMM · Tutorial 13 of 698

Link Functions Map Means to Linear Predictors

Learn to transform specified conditional means into linear predictors with the identity, logit, and log links, and to check whether each transformation is defined.

Beginner 9 min read

What You'll Learn

  • Define the link function \(g\) through the relationship between a conditional mean and its linear predictor.
  • Calculate identity-link predictors directly from response-scale means.
  • Convert a Bernoulli mean to a logit predictor using log-odds.
  • Convert a positive mean to a log-link predictor using its natural logarithm.
  • Check the allowable mean domain before applying a link.
  • Distinguish transforming a specified mean from estimating model coefficients.

Why Transform a Conditional Mean?

In a generalized linear model, the linear predictor is built from explanatory variables and coefficients, so it can take any real value. A conditional mean, however, may be restricted by the response distribution: a Bernoulli mean is a probability between zero and one, while a Poisson mean must be positive. A link function connects these two scales by transforming the conditional mean to the scale of the linear predictor.

The transformation does not change the response or turn its mean into an observation. It specifies how the mean is represented in the model. Once a particular mean is given, calculating its linear predictor means applying the chosen link to that mean. This tutorial focuses on that mapping and on checking that the input lies in the link's domain.

Definition: For observation \(i\), let \(\mu_i=E(Y_i\mid \mathbf{x}_i)\) be the conditional mean of the response \(Y_i\), given its covariates \(\mathbf{x}_i\). A link function \(g\) relates this mean to the linear predictor \(\eta_i\) by $$ g(\mu_i)=\eta_i. $$ In a regression model, the linear predictor is commonly written \(\eta_i=\mathbf{x}_i^\mathsf{T}\boldsymbol{\beta}\). The link \(g\) must be defined for the possible values of \(\mu_i\); for a standard one-to-one link, its range is the scale on which \(\eta_i\) lies.

The link and the linear predictor are related but not interchangeable terms. The link is a function, such as a logarithm; the linear predictor is the resulting number for a particular observation, such as \(\eta_i=0.9163\). This distinction matters when carrying out a calculation: begin with a specified conditional mean, apply the specified link, and report the result on the predictor scale.

Three Common Links and Their Domains

The identity, logit, and log links are common choices for different response-mean domains. Their definitions are compact, but checking the domain is part of using each one correctly.

LinkDefinitionMean domainLinear-predictor value
Identity\(g(\mu)=\mu\)All real numbers for the link itselfThe mean itself
Logit\(g(\mu)=\log\left(\frac{\mu}{1-\mu}\right)\)\(0<\mu<1\)Log-odds
Log\(g(\mu)=\log(\mu)\)\(\mu>0\)Natural logarithm of the mean

The identity link leaves the mean unchanged, so the predictor and mean have the same numerical value and units. The logit applies to a probability-valued mean, such as the conditional probability of success for a Bernoulli response. The log link applies to a strictly positive mean, such as a conditional mean count. Both logit and log outputs are dimensionless: the logit is a logarithm of odds, and a logarithm of a dimensional quantity is understood relative to a fixed unit. For example, if a mean is measured as a count per fixed observation interval, the numerical value to be logged uses that stated scale.

These choices are not a claim that every response must use one particular link. A link is selected as part of a model, subject to the response distribution and the scientific aim. The calculations below take both the link and the mean as given; they do not estimate the coefficients in \(\eta_i=\mathbf{x}_i^\mathsf{T}\boldsymbol{\beta}\).

Worked Example: Identity Link for a Conditional Mean

Suppose, hypothetically, a Gaussian-response model specifies a conditional mean of \(4.2\) hours for an outcome measured in hours, and uses the identity link. Find the linear predictor for this specified mean.

For the identity link, \(g(\mu)=\mu\). Substituting \(\mu_i=4.2\) hours gives $$ \eta_i=g(\mu_i)=\mu_i=4.2. $$

Thus the linear predictor is \(4.2\), on the same numerical scale as the mean, with units of hours. This calculation does not say that an observed response equals \(4.2\) hours; it says that the model's specified conditional mean maps to this predictor under the identity link.

Worked Example: Logit Link for a Bernoulli Mean

Suppose, hypothetically, the conditional probability of a Bernoulli outcome is specified as \(\mu_i=0.20\). Find its linear predictor under the logit link.

The input is valid because \(0<0.20<1\). Apply the definition and substitute: $$ \eta_i =\log\left(\frac{\mu_i}{1-\mu_i}\right) =\log\left(\frac{0.20}{1-0.20}\right) =\log\left(\frac{0.20}{0.80}\right) =\log(0.25) \approx -1.3863. $$

The linear predictor is approximately \(-1.3863\). The corresponding odds are \(0.20/0.80=0.25\), so the predictor is the natural logarithm of those odds. A negative predictor is compatible with a valid probability: it indicates odds below one, not a negative probability.

Worked Example: Log Link for a Positive Mean

Suppose, hypothetically, a Poisson-response model specifies a conditional mean of \(2.5\) events per fixed observation interval. Find the predictor using the log link.

The mean is positive, so the log link is defined. Substitution gives $$ \eta_i=g(\mu_i)=\log(\mu_i)=\log(2.5)\approx 0.9163. $$

The linear predictor is approximately \(0.9163\), using the numerical mean of \(2.5\) events per interval. It is not \(2.5\), because the log link transforms the mean. The chosen unit or interval matters when expressing a mean rate, so the scale used for the calculation should be stated and kept consistent.

Why the Logit Is a Log-Odds Transformation

The name “logit” comes directly from the probability-to-odds calculation. If a Bernoulli mean is \(\mu\), then \(\mu\) is the probability of success and \(1-\mu\) is the probability of failure. For \(0<\mu<1\), their ratio is the odds of success: $$ \text{odds}=\frac{\mu}{1-\mu}. $$ Taking the natural logarithm of these odds gives the logit. The domain restriction ensures that both the numerator and denominator are positive and that the odds are finite.

The transformation sends probabilities below \(0.5\) to negative values, \(0.5\) to zero, and probabilities above \(0.5\) to positive values. This follows because \(\mu/(1-\mu)\) is below one when \(\mu<0.5\), equals one at \(\mu=0.5\), and exceeds one when \(\mu>0.5\). The natural logarithm is negative below one, zero at one, and positive above one.

The log link has a related, but distinct, arithmetic meaning: it takes the natural logarithm of a positive mean itself, not of odds. The identity link applies neither logarithm nor odds conversion. Keeping these operations separate prevents a common source of incorrect calculations.

A Reliable Calculation Procedure

When a problem provides a conditional mean and names a link, the calculation can be organized into a short sequence. Check the mean's domain before taking a logarithm or forming odds; then substitute the mean into the exact definition of the link. Keep intermediate steps visible, especially for the logit, where using \(\mu\) in place of \(\mu/(1-\mu)\) gives the wrong answer.

1
Identify the specified mean.
Write \(\mu_i\) and state what it measures, including units or probability context.
2
Check the domain.
For the logit require \(0<\mu_i<1\); for the log require \(\mu_i>0\). The identity transformation has no such restriction on its own.
3
Apply the stated link.
Use \(\eta_i=\mu_i\), \(\eta_i=\log(\mu_i/(1-\mu_i))\), or \(\eta_i=\log(\mu_i)\), as appropriate.
4
Report the result on the predictor scale.
Give the numerical value at suitable precision and identify it as a linear predictor, not as a response observation.

Assumptions, Checks, and Failure Modes

A link calculation is valid only if the specified mean belongs to the domain of the chosen link. For the logit, a mean of exactly zero or one makes the odds respectively zero or undefined, and the logit is not finite. For the log link, a zero or negative mean has no real natural logarithm. These are mathematical domain failures, not small rounding inconveniences. If a problem gives such a value, do not silently apply the formula or replace the value with a nearby one; first determine whether the stated model or input needs clarification.

A separate modeling issue is that a link can be defined for means that may not be appropriate for a particular response. For example, the identity function is defined for every real mean, but a model for a probability-valued response must still represent means in the probability range. Domain validity of the function alone does not guarantee that a complete model yields allowable response-scale means. The consistency of fitted predictions is a distinct question from evaluating a link at a specified, valid mean.

The calculation also assumes the stated quantity really is the conditional mean to which the model applies. A sample proportion, an observed count, and a conditional probability are not interchangeable simply because each can be represented by a number. A link is applied to \(\mu_i=E(Y_i\mid\mathbf{x}_i)\), not automatically to an individual observed \(Y_i\) or to a sample summary. The response distribution and the meaning of the mean must be identified before the arithmetic begins.

Comparing the Choices and Their Limits

The links differ in the relationship they impose between the predictor scale and the mean scale. Identity gives a direct, additive-scale representation of the mean. Logit represents a probability through log-odds. Log represents a positive mean through its natural logarithm. Thus, if the same numerical mean is supplied to different links, the resulting predictors generally differ. For instance, at \(\mu=0.20\), identity gives \(0.20\), while logit gives approximately \(-1.3863\); these values arise from different transformations and should not be compared as though they were the same quantity.

The link choice has consequences for the shape and constraints of a model, but selecting among links requires more than calculating a transformation. It depends on the response type, the scientific question, and whether the resulting model is suitable. The present calculations do not establish that a particular link is best, nor do they estimate or interpret regression coefficients. They show how a chosen link maps a specified mean to a predictor.

A common mistake is to treat \(\eta_i\) as though it were always equal to \(\mu_i\), or to use the log link whenever a mean is positive without checking which link the model specifies. The correction is simple: write \(g\) explicitly, check its domain, and calculate \(g(\mu_i)\). Do not switch links mid-calculation, and do not describe a transformed predictor as a probability, count, or response mean unless it is on that scale.

Key takeaway: A link function maps a conditional mean to the linear-predictor scale: \(\eta_i=g(\mu_i)\). Identity returns the mean, logit returns log-odds for a probability strictly between zero and one, and log returns the natural logarithm of a positive mean.

Check Your Understanding

For each question, calculate or explain the requested link mapping before reading the short solutions.

  1. A specified conditional mean is \(7.3\) under the identity link. What is the predictor, and what scale does it use?
  2. A Bernoulli conditional mean is \(0.75\). Calculate its logit to four significant figures.
  3. A positive conditional mean is \(4\). Calculate its predictor under the log link.
  4. Why is the logit not defined as a finite real number for a Bernoulli mean of zero?
  5. A student applies the log link to a Bernoulli mean of \(0.30\). Identify the arithmetic result and explain why it is not the logit.

Solutions. (1) \(\eta=7.3\), in the same units as the specified mean. (2) \(\eta=\log(0.75/0.25)=\log(3)\approx 1.099\). (3) \(\eta=\log(4)\approx 1.386\). (4) The odds are \(0/(1-0)=0\), and \(\log(0)\) is not finite, so zero is outside the logit's domain. (5) The log-link calculation is \(\log(0.30)\approx -1.204\). It is not the logit, which is \(\log(0.30/0.70)\approx -0.8473\); the logit takes the logarithm of odds, not of the probability alone.

Clinical Biostats